Monthly Archives: October 2011 - Page 3

This week’s webcasts for education customers and partners 31 Oct – 4 November 2011

There are two webcasts to know about this week – one education-specific one (the Tech Tuesday) and one general one for technical teams.

All of the timings for the webcasts are AEST (Australia East Coast time).
See ** below for more details on how the webcasts work

This week’s webcasts

Tech Tuesday – IT Academy in Education

The Microsoft IT Academy is a programme that provides students with future-ready technology skills they need to be successful in careers. Read more about the IT Academy programme

Tuesday 1st November 11AM-12PM AEST – Register here for the webinar

Microsoft Office 365: Deployment Overview

This session provides guidance for individuals responsible for coordinating and performing customer deployment and migration activities related to migrating customers from their current environment to Office 365 for enterprises. This session guides attendees through three key deployment project phases: Plan, Prepare, and Migrate, focusing on the tasks handled by partners and customers, and providing a high-level review of tasks handled internally by Microsoft services teams. This session does not cover processes that occur prior to deployment (Sales and Initial Assessment) and post-deployment (Operations).
Note: This session is relevant for education customers, although the session covers generic Office 365, not specifically Office 365 for Education

Tuesday 1st November 2-4PM AEST – Register here for the webinar


Future webcasts

Date
Title
Register Here

8 November

Tech Tuesday -The Microsoft Office Suite in Education
Tech Tuesday’s are education-specific webinars, hosted by the Australian education team at Microsoft.

Find out more, and register

8 November

Upgrading to Microsoft SQL Server 2008 R2 and SQL Server Code-Named “Denali“: A Comprehensive Look

Find out more, and register

11 November

Microsoft System Center Virtual Machine Manager 2012: What’s in It, and How It Enables the Building of Private Clouds and Federation to the Public Cloud

Find out more, and register

15 November

Tech Tuesday - Learning Management Systems in Education
Tech Tuesday’s are education-specific webinars, hosted by the Australian education team at Microsoft.

Find out more, and register

15 November

Taking Office to the Cloud: Integrating Microsoft Office 2010 and Windows Azure

Find out more, and register

22 November

Tech Tuesday - Microsoft Partner story - nSynergy
Tech Tuesday’s are education-specific webinars, hosted by the Australian education team at Microsoft.

Find out more, and register

22 November

Managing Windows Azure Applications

Find out more, and register

22 November

Integrating Microsoft SharePoint 2010 and Microsoft Dynamics CRM Online

Find out more, and register

25 November

Integrating the Microsoft System Center Stack for Process Compliance and Automation

Find out more, and register

29 November

What’s New in Microsoft SQL Server Code-Named “Denali” for SQL Server Integration Services

Find out more, and register

6 December

Microsoft Lync 2010: Audio, Video and Web Conferencing Architecture and Experience

Find out more, and register

** By running them as webcasts, our aim is to allow you to get the latest news, without travel costs, or event fees. And with all of the advantages of being able to watch an online webcast whilst also being able to do other things if necessary. All of the free webcasts this week are one/two hour sessions, and combine presentations and live demonstrations.

You’ll need to register in advance, and you’ll then receive a Calendar note, as well as info on how to join the Live Meeting online. All of the timings given are for Australia East Coast time.

Partner Exam Academy your one-stop exam shop

Partner Exam Academy is a one-stop shop where partners can get training to prepare for Microsoft Certification exams with a choice of no-cost training in the PLC where available, or through our Learning Solutions Partners for partners who prefer training in their geo in local language.  The latest competency to join the Academy is Portals and Collaboration, to Communications and Messaging with training to help partners pass exam.

Homage à Dennis Ritchie …

Pour ceux qui n’ont pas connu le SICOB, il est vraisemblable que ce nom ne dira rien mais ce MONSIEUR, diplomé de Harvard, pionnier du système Unix, aussi créateur avec son compère Brian Kernighan du langage C (rappelez vous ce bouquin de référence de couleur noir), avant de recevoir le prix Turing. http://fr.wikipedia.org/wiki/Dennis_Ritchie

Pour ma part, je leur dois de nombreuses heures de développement et un petit ouvrage http://livre.fnac.com/a103610/Frederic-Aatz-Langage-C.

Respect !!!

?????? ??????-?????? ?? ??????? ?????????? ??? Windows Phone

???-???! ? ??? ?????? ?????? ????? ??????-?????? ?? ???????-?????????? ??? Windows Phone.

?????? ? ???? ??????:

 

 

 

??????? ???? ?? WebMatrix, ????? 5. ?????????? ? ??????????? Razor, ????????? ??? ? ASP.NET

??? ??????????? ???????? ????? ?? WebMatrix. ?????????? ????? ??????????? ????? ????? ?????:

? ???? ????? ?????? ????? ???????? ? ???????????????? ???-??????? ASP.NET ? ??????? ?????????? Razor. ASP.NET — ?????????? ???????? ???-?????????? ? ???-???????? ?? ???????? ??????????, ???????????? ???????????? ??????. ??? ???????? ????????? ?????? ????????? Microsoft .NET ? ????????? ????? ?????? ?????????? Microsoft ASP

???????? ??????? ????????????????

??? ?????????? ? ????? 1, ???? ??? ?????????? ??????????? ????? ???????????????? ? ??????? WebMatrix, ???-??????? ASP.NET ? ?????????? Razor ????? ?????? ????????? ???????????? ???-???????? ?? ???????? ??????????????? ?????????????, ? ??? ????? ?? ??????????? ??????? ????? ????.

? ???? ????? ?????? ????? ???-???????????????? ASP.NET. ??? ?? ????????????? ??????, ? ?????? ??????? ????? ??????? ????????????????, ??????? ????? ???????? ????? ??????????????. ??? ?? ?????, ? ???? ????? ?????????? ????? ???, ??? ??????????? ??? ???????? ?????????? ????? ???????????.

?? ??????? — ????????? ??????????? ?????.

????????? Razor, ????????? ??? ? ASP.NET

????????? Razor — ??? ??????? ????????? ???????????????? ??? ????????? ?????????? ???? ? ???-????????. ? ???-????????, ???????????? ????????? Razor, ?????????? ??? ???? ???????????: ?????????? ??????? ? ????????? ???. ?????????? ??????? – ??? ?? ??????????, ??????? ???????????? ? ???-?????????: ???????? HTML (????????), ???????? ? ?????, ???????? CSS, ?????????? ???????, ???????? JavaScript, ? ??????? ?????.

????????? Razor ????????? ???????? ? ????? ??????????? ???????? ????????? ???. ???? ?? ???????? ??????? ????????? ???, ?? ?????? ??????? ????????? ???? ???, ? ????? ?????????? ???????? ? ???????. ????????? ???? ??? ???????? ?? ???????, ?? ????? ????????? ??????? ????? ??????? ?????? ?? ????????? ? ?????????????? ?????? ??????????? ????????, ???????? ?????? ? ????????? ????? ??????. ?? ??????? ????? ????? ??, ??? ????????? ??? ????? ??????????? ????????? ?????????? ???????, ????????? ?? ????? ????????? ???????? HTML ??? ?????? ?????????? «?? ????», ? ????? ?????????? ? ??????? ?????? ? ????? ??????????? HTML, ????????? ? ????????. ?? ??????? ???????? ?????????? ???????, ????????? ????????? ?????, ????? ?? ?????????? ?? ????? ?????????? ??????????? ????????. ??? ??? ????? ???? ????????, ??????????? ????????? ??? ???????? ?????.

???-???????? ASP.NET, ?????????? ????????? Razor, ????? ??????????? ?????????? ????? (CSHTML ??? VBHTML). ?????? ?????????? ????? ??????????, ????????? ???, ?????????? ??????????? Razor, ? ????? ?????????? ???????? ? ???????.

????? ASP.NET ? ????????? ????????????????

????????? Razor ???????????? ?? ?????????? ??????????, ?????????? ASP.NET, ??????? ? ???? ??????? ???????????? ?? Microsoft .NET Framework. ????????? .NET Framework — ??? ??????? ????????????? ?????????????? ???????????????? ?? ?????????? ?????????? ??? ?????????? ???????????? ?????????? ?????? ????.

ASP.NET ???????? ?????? ????????? .NET Framework, ?????????? ????????????? ??? ???????? ???-??????????. ???????????? ???????????? ASP.NET ??? ???????? ?????? ?? ????? ??????? ? ???? ???-?????? ? ????? ??????? ?????????. (?????? ?????????? ????? ????? ASPX ??? ????? URL-?????? ?????, ????? ??????, ??? ???? ???? ??? ?????? ? ??????? ASP.NET.)

????????? Razor ????????????? ??? ??????????? ASP.NET, ?? ?????????? ?????????? ?????????, ??? ????????? ???????? ??? ?????????? ? ???????? ?????????????????? ????????????. ???? ??? ???, ??? ???? ????????? ????? ? ?????????????, ??? ?????? ????? ? ASP.NET ? ?????????? .NET Framework ????????, ??? ?? ???? ?????????? ???-?????? ???????? ????????? ??? ???? ??????? ?????????????.

image

?????? ? ??????????

????????? ??? ASP.NET ?????????? ???????, ??????? ? ???? ??????? ????????? ?? ????????? ???????. ????? — ??? ??????????? ??? ?????? ???????. ????????, ?????????? ????? ????????? ????? Customer, ???????? ???????? ? ??????, ??????? ?????????? ??????? ??????? «??????».

????? ?????????? ??????????? ???????? ?? ?????????? ????????? ???????, ????????? ????????? (??? ??????????) ??????? «??????». ?????? ?????? ???????? ????????? ??????????? ?????? Customer. ?????? ????????? ???????????? ???? ? ?? ?? ???????? ? ??????, ?? ???????? ??????? ??? ??????? ?????????? ?????? ??????????, ????????? ?????? ?????? «??????» ???????? ??????????. ? ????? ??????? «??????» ???????? LastName ????? ????? ???????? «??????», ? ?????? — «??????».

??????????, ?????? ????????? ???-???????? ????? ???????????? ????? ?????? «????????», ?????????? ??????????? ?????? Page. ?????? ?? ???????? ???????????? ????? ?????? «??????», ??????? ???????? ??????????? ?????? Button, ? ?. ?. ?????? ????????? ????? ???? ??????????? ??????????????, ?? ??? ??? ???????????? ?? ???, ??? ??????? ? ??????????? ?????? ???? ????????.

???? ? ?????????

? ?????????? ????? ?????????? ??????? ?????? ???????? ???-???????? ASP.NET ? ?????????? ?????????? ???? ? ???????? HTML. ????? ????? ??????????? ???????? ???????? ????????? ?????????? ???? ASP.NET ? ??????? ?????????? Razor, ?. ?. ? ??????? ?????? ????? ????????????????.

??? ??????? ???? ???????????????? (???????? ?? ?????? C, C++, C#, Visual Basic ??? JavaScript) ??????? ????? ?????????? ???????? ????? ???????. ????????, ??????????? ???????????? ?????? ? ???, ??? ????????? ??? ??????????? ? ???????? ? CSHTML-??????.

???????? ?????????

??????????? ??????, ???????? ? ???? ? ?????? ????

????? ????????? ??????????? ?????????? ????, ?????? ? ???????? ? ?????? ?????????? ????. ??? ???? ?????????? ???????????? ASP.NET ??????????? ???????? ???? ?? ???????. ????? ?????????? ???????? ???????????????? ??????? ??????????? ??????????? ? ???????.

???? ?????, ?????????? ???????? HTML ??? ????????? ???, «??? ????». ????? ?????? ????????, ???? ? ?????? ?????????? ?????? ????????? ??? ??? ???????? HTML (??? ? ??, ? ??????), ?? ??????????? ??????? ????? (?. ?. ?????, ?? ?????????? ? ???? HTML).

@if(IsPost) {

<p>????????????, ?????? @DateTime.Now, ? ?????? ???????? ???????? ???????? ?????????!</p>

} else{

<p>????????????, <em>??????????!</em> ??????: </p> @DateTime.Now

}

???? ????????? ?????, ?????????? ??????? ?????, ? ??????? ????????? @:. ????? ?????? ????? ????????? ??????? ????? ? ????? ?????????? ???????? ? ????. ? ????? ??????, ?????????? ??????? ????? ? ??? ??? ????????, ???????? @: ??????? ????????? ????? ?????? ?????????? ???????? ??????:

@{

@:???? ??????: @DateTime.Now.DayOfWeek. <em>??????????</em> ????!

}

???????? @: ?????????? ???????????? ?????? ???? ??? ? ??????.

???? ?????????? ?????, ?????????? ??????? ????? ? ????????? ???, ? ??????? ???????? <text>. ???? ??????? ????? ???????????? ? ????????? ?????? ?????????? ????????? @: ??? ? ?????????? ??????? ?????????? ?????? ? ????.

??????????. ASP.NET ??????? ?? ?????????? ???? <text> ? ???????? ????????, ???????????? ? ???????. ??? ???? ???????????? ?????? ? ????????? ????, ????? ?????? ASP.NET ???????? ????? ?? ????.

@{

var minTemp = 22;

<text>?????? ????? @DateTime.Now.ToString("MMMM"), ?

??????? <em>??????????</em> ????! <p>?? ?????? ????? ????????, ???? ???????????

?? ???? @minTemp ????????. </p></text>

}

??????????? HTML

??? ?????????? ??????? @ ? ?????? ???? ASP.NET ????????? HTML-??????????? ????????? ??????????. ????????????????? ??????? HTML (????? ??? < ? > ??? &) ?????????? ?? ????, ??????????? ?????????? ?????????? ??? ??????? ?? ???-????????. ??? ??????????? HTML ????????? ?????????? ?????????? ???? ????? ???????????? ???????????, ? ????? ????? ?????????? ???????? ??????? ????????????. ?????????????? ???????? ? ??????????? HTML ??. ? ????????? ??????.

???????

?????????????? ??????? ? ????????? (? ??? ?????????? ????????) ?? ?????? ?? ???? ????????.

@{ var lastName = "??????"; }

?????? ?????? ? ????????? ?? ?????? ?? ????????, ??????? ????? ????????? ????????? ??? ???????????????. ??????????? ????? ????????? ?????????.

@{ var lastName =

"??????"; }

@{

var

lastName

=

"??????"

;

}

??? ?????????, ?????????????? ????, ????????? ????????? ? ??????????? ???? ?????? ?????????.

?????? ?????? ????????? ?????? ?????? ?????????? ????????. ???? ?????????? ?????? ?????????????????? ?????????.

@{ var test = "??? ???????

??????"; } // ??? ?? ????????!

????? ?????????? ??????? ?????, ???????? ?? ????????? ?????, ??? ? ?????????? ???????, ? ???? ??????? ??????, ??????? ???????????? ???????? ??????????? (+), ??????? ????? ??????? ????? ? ???? ?????.

?????????? ? ????

?????????? ????????? ????????? ??????? ??? ???? ??? ??????. ?????????? ? ????? ?????? ???? ???????????? ????? ?????? ??????? (//) ? ?? ????? ???????????? ???????. ?? ????????? ? Web Matrix ??????????? ????????? ??????? ???????.

@// ????? ????????? ?????????? ? ????.

????????????? ??????????? ??????????? ????? ????????? /* ? */. ?? ?????? ??????? ??? ? ??????????? ????.

@/*

????????????? ?????????? ? ?????????? ???? ????? ?????????

????? ????????? ?????????????? ??????????, ????????????? ?

????? C#, ????????? ?? ???????? @.

*/

@{

// ????? ????????? ?????????? ? ????.

/*

????????????? ?????????? ? ?????????? ???? ????? ????????? ?????

????????? ?????????????? ??????????, ????????????? ? ????? C#.

*/

}

??????????

?????????? — ??? ??????????? ??????, ???????????? ??? ???????? ??????. ?????????? ????? ?????? ????? ?????, ?? ??? ?????? ?????????? ? ????? ? ?? ????? ????????? ???????? ??? ????????????????? ???????.

?????????? ? ???? ??????

?????????? ????? ????? ???????????? ??? ??????, ??????????? ??? ??????, ?????????? ? ???? ??????????. ????? ????????? ?????????? ???? string, ???????? ????????? ???????? (???????? «??????????, ???»), ?????????? ???? integer, ???????? ????? ????? (???????? 3 ??? 79), ?????????? ???? date, ???????? ???? ? ????? ?????? ???????? (???????? «4/12/2010» ??? «???? 2009»). ?????????? ????????? ?????? ????? ??????, ??????? ????? ????????????. ?????? ??? ??????? ??? ?????????? ????????? ?????????????. ? ??????????? ??????? ASP.NET ????? ?????????? ???, ?????? ?? ??????? ????????????? ?????? ? ??????????. (?????? ?????????? ???????? ??? ??????; ? ?????? ??????????? ????? ??????????? ??????? ????? ????????.)

?????????? ??????????? ? ??????? ????????? ????? var (???? ?? ????????? ???????? ???) ??? ? ??????? ????? ????.

@{

// ?????????? ?????????? ??????.

var greeting = "????????????!";

// ?????????? ?????????? ?????.

var theCount = 3;

// ?????????? ?????????? ?????????.

var monthlyTotal = theCount + 5;

// ?????????? ?????????? ???????? ????.

var today = DateTime.Today;

// ?????????? ?????????? URL-?????? ??????? ????????.

var myPath = this.Request.Url;

// ?????????? ?????????? ? ??????? ????? ????? ??????.

string name = "????";

int count = 5;

DateTime tomorrow = DateTime.Now.AddDays(1);

}

? ????????? ??????? ???????????? ????????? ????????? ????????? ????????????? ?????????? ? ???-?????????.

@{

// ????????? ???????? ?????????? ? ???????? HTML.

<p>@greeting, ??????!</p>

// ????????????? ?????????? ??? ????? ??????????? ?????????.

<p>????????? ??????? ????: @( monthlyTotal * 12)</p>

// ??????????? URL-?????? ???????? ? ??????? ??????????.

<p>URL-????? ???? ????????: @myPath</p>

}

?????????, ??????? ????????? ? ????????:

image

?????????????? ? ???????????? ????? ??????

???? ASP.NET ?????? ????? ?????????? ??? ?????? ?????????????, ?????? ??? ??????????. ?????????????, ?????????? ?????? ASP.NET, ???????? ????? ??????????????. ???? ???? ?????????????? ????? ?? ?????????, ?????? ??????? ????????? ??? ??? ????????, ????? ???????, ? ????? ????? ?????? ???????? ????????.

?????? ??????????? ?????????????? ?????????? ? ?????? ???. ???? ????? ?????????? ??????????????? ?????? (??? string) ? ?????? ???, ???????? ? integer ??? date. ? ????????? ??????? ???????????? ???????? ????????, ????? ?????????? ????????????? ?????? ? ?????.

@{

var total = 0;

if(IsPost) {

// ?????????? ?????, ????????? ?????????????.

var num1 = Request["text1"];

var num2 = Request["text2"];

// ?????????????? ????????? ????? ? ????? ????? ? ?? ????????.

total = num1.AsInt() + num2.AsInt();

}

}

??? ???????, ??????, ????????? ?????????????, ?????????? ? ????????? ??????????. ???? ???? ????????????? ???? ????? ? ???????????? ?????? ?????, ????? ???????? ????????????????? ????? ? ?????? ??? ? ???? ?????? ????????? ? ??????? string. ?????????????, ?????????? ????????????? ??? ?????? ? ?????. ? ?????? ??????? ??? ??????? ????????? ?????????????? ???????? ?? ?????????? ??? ?? ?????????????? ????????? ????????? ??????, ????????? ASP.NET ?? ????? ?????????? ??? ??????:

?? ??????? ?????? ????????????? ??? ‘string’ ? ‘int’.

??? ?????????????? ???????? ? ????? ????? ?????????? ????? AsInt. ???? ?????????????? ??????????? ???????, ????? ????? ??????? ??? ?????.

? ????????? ??????? ????????? ???????? ???????????????? ?????? ?????????????? ? ???????????? ??? ??????????.

?????

????????

??????

AsInt(),
IsInt()

??????????? ??????, ?????????????? ????? ????? (???????? "539"), ? ????? ?????.

var myIntNumber = 0;

var myStringNum = "539";

if(myStringNum.IsInt()==true){

    myIntNumber = myStringNum.AsInt();

}

AsBool ( ) ,
IsBool ( )

??????????? ?????? "true" ??? "false" ? ?????????? ??? Boolean.

var myStringBool = "True";

var myVar = myStringBool.AsBool();

AsFloat ( ) ,
IsFloat ( )

??????????? ??????, ?????????? ?????????? ????????, ???????? "1.3" ??? "7.439", ? ????? ? ????????? ???????.

var myStringFloat = "41.432895";

var myFloatNum = myStringFloat.AsFloat();

AsDecimal ( ) ,
IsDecimal ( )

??????????? ??????, ?????????? ?????????? ????????, ???????? "1.3" ??? "7.439", ? ?????????? ?????. (?????????? ????? ????? ??????, ??? ????? ? ????????? ???????.)

var myStringDec = "10317.425";

var myDecNum = myStringDec.AsDecimal();

AsDateTime ( ),
IsDateTime ( )

??????????? ??????, ?????????????? ???????? ???? ? ???????, ? ??? ASP.NET DateTime.

var myDateString = "12/27/2010";

var newDate = myDateString.AsDateTime();

ToString ( )

??????????? ????? ?????? ??? ?????? ? ??????.

int num1 = 17;

int num2 = 76;

// myString is set to 1776

string myString = num1.ToString() +

  num2.ToString();

?????????

???????? — ??? ???????? ????? ??? ??????, ?????????? ASP.NET, ????? ??? ??????? ??????? ????????? ? ?????????. ???? C# (? ?????????????? ?? ??? ????????? Razor) ???????????? ????? ??????????, ?????? ??? ?????? ?????????? ???-??????? ASP.NET ?????????? ?????? ????? ?????????. ? ????????? ??????? ????????? ???????? ???????????????? ?????????.

????????

????????

???????

.

?????. ???????????? ??? ????????? ???????? ? ?? ??????? ? ???????.

var myUrl = Request.Url;

var count = Request["Count"].AsInt();

( )

??????? ??????. ???????????? ??? ????????????? ????????? ? ??? ???????? ?????????? ? ??????.

@(3 + 7)

@Request.MapPath(Request.FilePath);

[ ]

?????????? ??????. ???????????? ??? ??????? ? ????????? ? ???????? ??? ??????????.

var income = Request["AnnualIncome"];

=

??????????. ??????????? ???????? ? ?????? ??????? ????????? ??????? ? ????? ???????. (?? ??????? ?????? ???????? ?????????? (=) ? ???????? ????????? (==).)

var age = 17;

!

?? (?????????). ??????????? ???????? ???????? ? ?????? ? ????????. ?????? ???????????? ? ???????? ??????????? ??????? ???????? ?? ???????? (?.?. ?? ??????????).

bool taskCompleted = false;

// Processing.

if(!taskCompleted) {

    // Continue processing

}

==

?????????. ?????????? true, ???? ???????? ?????.

var myNum = 15;

if (myNum == 15) {

    // Do something.

}

!=

???????????. ?????????? true, ???? ???????? ?? ?????.

var theNum = 13;

if (theNum != 15) {

    // Do something.

}

<
>
<=
>=

?????? ???,
?????? ???,
?????? ??? ?????,
?????? ??? ?????.

if (2 < 3) {

    // Do something.

}

var currentCount = 12;

if(currentCount >= 12) {

    // Do something.

}

+
-
*
/

?????????????? ?????????, ????????????? ? ????????? ??????????.

@(5 + 13)

@{ var netWorth = 150000; }

@{ var newTotal = netWorth * 2; }

@(newTotal / 2)

+

???????????; ???????????? ??? ?????????? ?????. ASP.NET ????????? ???? ???????? ? ???????? ???????? ?? ?????? ???? ?????? ?????????.

// The displayed result is "abcdef".

@("abc" + "def")

& &

| |

?????????? ????????? ? ? ???, ??????? ???????????? ??? ????? ???????.

bool myTaskCompleted = false;

int totalCount = 0;

// Processing.

if(!myTaskCompleted && totalCount < 12) {

    // Continue processing.

}

+=

-=

????????? ?????????? ? ??????????, ?????????????? ????????????? ??? ??????????? ???????? ?????????? ?? ???????.

int theCount = 0;

theCount += 1; // Adds 1 to count

?????? ? ?????? ? ?????? ? ?????? ? ????

? ???? ????? ?????????? ???????? ? ?????? ? ?????? ? ??????. ????? ?????????? ?????? ?????????? ????????? ????? ??? ???-?????, ??? ??? ????? ?? ????????? ?? ?????????? ????????????.

C:\WebSites\MyWebSite

    default.cshtml

    datafile.txt

    \images

        Logo.jpg

    \styles

        Styles.css

?? ???-??????? ???? ????? ????? ??????????? ????????? ?????, ??????????????? ?????????? ?????? ?????. ?? ????????? ??????????? ????? ????? ????????? ? ??????????? ??????? ?????. ??????????? ???????? ????? ?????????????? ????? ?????? (/), ?????????? ????, ??? ???????? ????? ?? ????? C: ?????????? ?????????????? ???????? ????? ?????? (\). (? ????? ??????????? ????? ?????? ???????????? ????? ????? (/).) ????? ?????????? ?????????? ? ??????????? ???? ??? ????? StyleSheet.css ?? ?????????? ????? ?????????.

  • ?????????? ????: C:\WebSites\MyWebSiteFolder\styles\StyleSheet.css
  • ??????????? ???? (?? ??????????? ???????? ????? /): /styles/StyleSheet.css

??? ?????? ? ??????? ? ??????? ? ???? ? ????????? ????????? ?????? ?????????? ????????? ?? ?????????? ????, ? ? ?????? ????????? — ?? ??????????? ????, ? ??????????? ?? ????, ? ?????? ????????? ?????????? ????????. ASP.NET ????????????? ????????? ???????? ??? ?????? ? ?????? ? ?????? ? ?????? ? ????: ???????? ~, ????? Server.MapPath ? ????? Href.

???????? ~. ????????? ??????????? ???????? ?????

???????? ~ ????????????, ????? ??????? ??????????? ???????? ???? ? ?????? ? ??????. ??? ??????, ????????? ????????? ?????????? ???-???? ? ?????? ????? ??? ? ?????? ????????????, ??? ???? ???? ? ???? ????????? ???????????.

@{

    var myImagesFolder = "~/images";

    var myStyleSheet = "~/styles/StyleSheet.css";

}

????? Server.MapPath. ?????????????? ??????????? ????? ? ??????????

????? Server.MapPath ??????????? ??????????? ???? (????? ??? /default.cshtml) ? ?????????? ?????????? ???? (????? ??? C:\WebSites\MyWebSiteFolder\default.cshtml). ???? ????? ???????????? ??? ?????, ? ??????? ????????? ?????? ?????????? ????, ???????? ??? ?????? ??? ?????? ????????? ?????? ?? ???-???????. (?????? ?????????? ?????????? ???? ????? ?? ??????????? ??????? ??????????.) ??????????? ???? ? ????? ??? ????? ?????????? ? ?????, ? ????? ?????????? ?????????? ????.

@{

var dataFilePath = "~/dataFile.txt";

}

<!– ?????????? ?????????? ???? C:\Websites\MyWebSite\datafile.txt –>

<p>@Server.MapPath(dataFilePath)</p>

????? Href. ???????? ????? ? ???????? ?????

????? Href ??????? WebPage ??????????? ????, ????????? ? ????????? ???? (??????? ????? ???????? ???????? ~) ? ????, ??????? «????????» ???????. (??????? «?? ????????» ???????? ~, ????????? ??? ???????? ?????? ASP.NET.) ????? Href ???????????? ??? ???????? ????? ? ????? ????????, ??? ????? ???????????, ?????? ???-???????? ? CSS-?????. ????????, ???? ????? ????? ????????? ? ???????? HTML ??? ????????? ????????? <img>, <link> ? <a>.

<! ???? ??? ??????? ???? "../images/Logo.jpg" ? ???????? src. >

<img src="@Href(myImagesFolder)/Logo.jpg" />

<!– ???? ??? ??????? ??? ?? ?????????, ????????? ???? ? ~ –>

<img src="@Href("~/images")/Logo.jpg" />

<!– ???? ??? ??????? ?????? ?? CSS-????. –>

<link rel="stylesheet" type="text/css" href="@Href(myStyleSheet)"/>

?????? ??????? ? ?????

????????? ??? ASP.NET ????????? ????????? ?????? ?? ?????? ??????? ? ?????? ???, ??????? ????????? ????????? ???????????? ????? ??? (?????).

???????? ???????

??? ???????? ???????? ??????? ???????????? ???????? if, ??????? ? ??????????? ?? ?????????? ???????? ?????????? ??????? ?????????? ???????? true ??? false.

@{

  var showToday = true;

  if(showToday)

  {

    @DateTime.Today;

  }

}

???????? ????? if ???????? ????. ??????? ??????????? ? ??????? ??????, ? ??? ???????? ?????????? true ??? false. ?????????, ??????? ??????????? ? ??????, ????? ??????? ???????, ??????????? ? ???????? ??????. ???????? if ????? ???????? ???? else, ? ??????? ???????? ????????? ??? ?????????? ? ??? ??????, ???? ??????? ?? ???????????.

@{

var showToday = false;

if(showToday)

{

@DateTime.Today;

}

else

{

<text>????!</text>

}

}

? ??????? ????? else-if ????? ????????? ????????? ???????.

@{

var theBalance = 4.99;

if(theBalance == 0)

{

<p>??? ?????? ???????.</p>

}

else if(theBalance > 0 && theBalance <= 5)

{

<p>??? ?????? $@theBalance ????? ?????.</p>

}

else

{

<p>??? ??????: $@theBalance</p>

}

}

? ???? ??????? ? ??????, ????? ?????? ??????? ?? ???????? ????????, ??????????? ???????? ??????? else if. ???? ??? ??????? ??????????? ??? ????????, ?? ??????????? ????????? ? ????? else if. ???? ?? ???? ?? ??????? ?? ??????????? ??? ????????, ?? ??????????? ????????? ? ????? else. ????? ???????? ????? ?????????? ?????? else if ? ??????? ???????? ?????? else ? ???????? ??????? «??? ????????? ??????».

??? ???????? ???????? ????? ??????? ????? ???????????? ???? switch.

@{

var weekday = "?????";

var greeting = "";

switch(weekday)

{

case "???????????":

greeting = "????????????, ??????? ???????? ???????????";

break;

case "???????":

greeting = "??????? ????????????? ???????";

break;

case "?????":

greeting = "????????? ???????? ?????!";

break;

default:

greeting = "??????? ?????-?? ?????? ????, ???????.";

break;

}

<p>????????? ?????? @weekday, ????????? ???: @greeting</p>

}

???????? ??? ???????? ??????????? ? ??????? ?????? (? ?????? ??????? ??? ?????????? weekday). ?????? ????????? ???????? ?????????? ???????? case, ??????? ????????????? ?????????? (:). ???? ???????? ????????? case ????????????? ???????????? ????????, ?? ??????????? ??? ? ???? ????? case. ?????? ???????? case ??????? ????????? ?????????? break. (???? ?? ???????? break ? ?????? ???? case, ?? ????? ????? ???????? ??? ?? ?????????? ????????? case.) ???? switch ????? ????? ???????? ?? ????????? ??? ???????? «??? ????????? ??????», ??????? ??????????? ? ??? ??????, ????? ?? ???? ?? ?????????, ????????????? ? ?????????? case, ?? ??????????? ??? ????????.

????????? ????????? ???? ??????, ??????? ?????????? ? ????????:

image

??? ? ?????

????? ????????? ????????????? ??????????? ????????? ???? ? ?? ?? ?????????. ??? ????? ???????, ???????? ?? ? ????. ????????, ????? ??? ??????? ???????? ? ????????? ?????? ??????????? ???? ? ?? ?? ?????????. ???? ????? ????????, ??????? ??? ????? ????????? ??? ?????????, ????? ???????????? ???? for. ???? ??? ????? ???????? ?????? ??? ??????? ??? ????????? ???????.

@{

    for(var i = 10; i < 21; i++)

    {

        <p style="font-size: @(i + "pt")">?????? ??? ?????? ??????: @i</p>

    }

}

???? ?????????? ???????? ?????? for, ?? ??? ? ??????? ??????? ??????? ??? ?????????, ?????? ?? ??????? ????????????? ?????? ? ???????.

  • ?????? ???????? ? ??????? ??????? (var i=10;) ??????? ??????? ? ?????????????? ??? ????????? 10. ???????? ??? ???????? i ?? ???????????, ????? ???????????? ????? ?????????? ??? ??????????. ??? ?????????? ????? for ??????? ?????????????? ?????????????.
  • ?????? ???????? (i < 21;) ????????????? ???????, ??????????? ???????????? ???????? ????????. ? ?????? ?????? ???????????? ???????? ???????? — 20 (?. ?. ?????????? ?????? ???????????, ???? ??????? ?????? 21).
  • ? ??????? ????????? (i++ ) ???????????? ???????? ??????????, ??????? ?????? ?????????, ??? ??????? ?????? ??????????? ?? 1 ??? ?????? ?????????? ?????.

? ???????? ??????? ????????? ???, ??????? ????? ??????????? ??? ?????? ??????? ?????. ??? ?????? ?????????? ????? ???????? ??????? ????? ???????? (??????? <p>) ? ????????????? ??????? ???????? i (????????) ? ???????? ??????? ?????? ? ???? ?????????. ??? ??????? ???? ???????? ?????? ?????? ??????? 11 ?????, ???????????? ?????????, ?????? ????? ? ?????? ?????? ?????????? ??????? ?? ???? ?????.

image

??? ?????? ? ?????????? ??? ???????? ????? ???????????? ???? foreach. ????????? — ??? ?????? ?????? ????????, ? ???? foreach ????????? ????????? ?????? ??? ??????? ???????? ? ?????????. ???? ??? ????? ???????? ??? ?????????, ?????? ??? ? ??????? ?? ????? for ? ??? ?? ????????? ?????????? ???????? ??? ????????? ???????. ???? foreach ?????? ???????? ?? ???? ?????????, ???? ??? ?? ??????????.

? ??????????? ????? ??????? ???????????? ???????? ?? ????????? Request.ServerVariables (?????????? ???????? ? ???-???????). ? ???? ??????? ???? foreach ???????????? ??? ??????????? ????? ??????? ???????? ????? ???????? ?????? ???????? <li> ? ????????????? ?????? HTML.

<ul>

@foreach (var myItem in Request.ServerVariables)

{

<li>@myItem</li>

}

<ul>

?? ???????? ?????? foreach ??????? ??????????? ? ??????? ?????? ?????????? ??????????, ?????????????? ???? ??????? ? ????????? (? ?????? ??????? – var), ?? ??? ???????? ????? in ? ?????????, ? ??????? ?????? ??????????? ????. ? ???? ????? foreach ????? ???????? ?????? ? ???????? ???????? ? ??????? ??????????? ????? ??????????.

image

??? ???????? ????? ?????????????? ????? ???????????? ???????? while.

@{

var countNum = 0;

while (countNum < 50)

{

countNum += 1;

<p>Line #@countNum: </p>

}

}

???? while ?????????? ? ????????? ????? while, ????? ? ??????? ??????? ??????????? ???????, ??? ????? ?????? ??????????? ???? (? ?????? ?????? — ?? ??? ???, ???? countNum ?????? 50), ? ????? ??????????? ???? ??? ??????????. ????? ?????? ??????????? ??? ????????? ???????????? ??? ???????? ?????????? ??? ??????. ? ?????? ??????? ???????? += ????????? 1 ? countNum ?????? ??? ??? ?????????? ?????. (??? ?????????? ?????????? ? ????? ? ???????? ????????? ??????? ???????????? ???????? ?????????? –=)

image

??????? ? ?????????

????? ??? ? ???-????? ASP.NET ???????? ????????, ??????? ???? ???-????????. ? ???? ??????? ??????????????? ????????? ?????? ???????, ? ???????? ???????? ????? ???????? ? ????.

???????-????????

???????? ???????? ? ASP.NET ???????? ????????. ?????? ? ????????? ???????-???????? ????? ???????? ????????, ??? ?????-???? ???????????? ???????. ? ????????? ???? ??????????? ???? ????? ? ??????? ??????? Request ????????.

@{

var path = Request.FilePath;

}

????? ??????? ????? ????????? ??, ??? ??????????? ?????? ?? ???????? ? ?????? ??????? ????????, ????? ????????????? ???????????? ???????? ????? this ??? ????????????? ???????-???????? ? ????. ? ????????? ??????? ? ?????????? ??? ????????? ???????? ????? this.

@{

var path = this.Request.FilePath;

}

????????? ???????? ???????-???????? ????????? ???????? ????????? ???????? ? ???.

  • Request. ??? ??? ??????????? ?????, ??? ???????? ???????????? ????????? ???????? ? ??????? ???????, ??????? ??? ????????, ???????????? ??????, URL-????? ????????, ????????????? ???????????? ? ?.?.
  • Response. ??? ????????? ???????? ?? ??????? (????????), ???????????? ???????? ????? ?????????? ?????????? ?????????? ????. ????????, ??? ???????? ????? ???????????? ??? ?????? ???????? ? ??????.

@{

    // ?????? ? ??????? Request ???????? ??? ????????? URL-??????.

    var pageUrl = this.Request.Url;

}

    <a href="@pageUrl">??? ????????</a>

??????? ????????? (??????? ? ???????)

????????? — ??? ?????? ???????? ?????? ????, ???????? ????????? ???????? Customer ?? ???? ??????. ? ASP.NET ??????? ????????? ?????????? ?????????, ???????? ????????? Request.Files (??????????? ?????).

????? ?????????? ???????? ? ??????? ? ?????????. ??? ???????? ???? ????????? — ??? ?????? ? ???????. ??????? ????????????, ????? ?????????? ????????? ????????? ?????????? ?????????, ? ?? ????????? ????????? ????????? ?????????? ??? ???????? ??????? ????????.

@* // ???? ??????? 1. ?????????? ?????? ??????? ? ??????? ??????.*@

 

@{

<h3>????? ??????</h3>

string[] teamMembers = {"??????", "????", "????", "????"};

foreach (var person in teamMembers)

{

<p>@person</p>

}

}

image

??? ?????????? ???????? ??????????? ???????????? ??? ??????, ???????? string, int ??? DateTime. ????? ???????, ??? ?????????? ????? ????????? ??????, ? ?????????? ??????????? ?????????? ?????? (???????? string[] ??? int[]). ?????? ? ????????? ??????? ?????????????? ? ??????? ?? ????????? (???????) ??? ? ??????? ????????? foreach. ??????? ??????? ?????????? ? ????, ?.?. ?????? ??????? ????????? ? ??????? 0, ?????? – ? ??????? 1 ? ?.?.

@{

string[] teamMembers = {"??????", "????", "????", "????"};

<p>?????????? ???? ? ??????? teamMembers: @teamMembers.Length </p>

<p>???? ????????? ? ???????: @Array.IndexOf(teamMembers, "????")</p>

<p>??????? ??????? ? ??????? 2 (? ???????? ?? 0) –@teamMembers[2]</p>

<h3>??????? ??????? ?????? ?????? ? ??????</h3>

foreach (var name in teamMembers)

{

<p>@name</p>

}

<h3>???????? ??????? ?????? ?????? ? ??????</h3>

Array.Reverse(teamMembers);

foreach (var reversedItem in teamMembers)

{

<p>@reversedItem</p>

}

}

?????????? ????? ????????? ? ??????? ????? ? ??????? ???????? Length. ????? ???????? ??????? ??????????? ???????? ? ??????? (????????? ????? ? ???????), ??????? ???????????? ????? Array.IndexOf. ????? ????? ????????? ????? ????????, ??? ????????? ??????? ?????????? ??????? ?? ??????????????? (? ??????? ?????? Array.Reverse) ??? ?????????? ????????? ??????? (? ??????? ?????? Array.Sort).

????????? ?????? ???? ???????? ?????????? ???????, ??????? ????????? ? ????????:

image

??????? — ??? ????????? ??? ????/????????, ????? ??? ????????? ??? ????????? ???????????????? ???????? ??????????????? ???? (??? ???).

@{

var myScores = new Dictionary<string, int>();

myScores.Add("test1", 71);

myScores.Add("test2", 82);

myScores.Add("test3", 100);

myScores.Add("test4", 59);

}

<p>??? ????????? ????? 3: @myScores["test3"]%</p>

@(myScores["test4"] = 79)

<p>??? ???????????? ????????? ????? 4: @myScores["test4"]%</p>

image

??? ???????? ??????? ???????????? ???????? ????? new, ???????????, ??? ????????? ????? ??????-???????. ????? ????????? ??????? ??????????, ???????????? ???????? ????? var. ???? ?????? ????????? ??????? ???????? ? ??????? ??????? ?????? ( < >). ? ????? ?????????? ?????????? ???????? ???? ??????? ??????, ????????? ?????????? ??? ?????, ????????? ????? ???????.

????? ???????? ???????? ? ???????, ????? ??????? ????? Add ?????????? ??????? (? ?????? ?????? myScores), ? ????? ??????? ???? ? ????????. ????? ????, ????? ??????? ???? ? ?????????? ??????? ? ????????? ??????? ??????????, ??? ? ????????? ???????.

myScores["test4"] = 79;

????? ???????? ???????? ?? ???????, ??????? ??????? ???? ? ?????????? ???????.

var testScoreThree = myScores["test3"]

????? ??????? ? ???????????

??? ?? ?????? ? ?????? ???? ?????, ??????? ? ????? ????????? ????? ????? ??????. ????????, ? ??????? ???? ?????? ????? ???? ???????? database.connect ?????. ?????? ?????? ????? ???? ??? ????????? ??????????. ?????????? ???????? ????????, ??????? ?? ??????? ?????? ??? ?????????? ?????????? ??????. ????????, ?????????? ?? ??????? ?????? Request.MapPath, ??????? ????????? ??? ?????????:

public string MapPath(string virtualPath, string baseVirtualDir, bool allowCrossAppMapping);

???? ????? ?????????? ?????????? ???? ?? ???????, ??????? ????????????? ?????????? ???????????? ????. ??? ????????? ??? ?????? VirtualPath, baseVirtualDir ? allowCrossAppMapping. (???????? ????????, ??? ? ???????, ????????? ????????? ? ?????? ??????, ??????? ??? ??????.) ??? ?????? ????? ??????, ?????????? ??????? ???????? ??? ???? ???? ??????????.

????????? Razor ???? ??? ??? ???????? ??? ???????? ?????????? ? ?????: ??????????? ????????? (positional parameters) ? ??????????? ????????? (named parameters). ??? ?????? ?????? ? ??????? ??????????? ??????????, ?? ????????? ????????? ? ?????? ?? ????????, ????????? ? ?????????? ??????. (?? ?????? ????? ????? ??? ?????????, ???????? ?????? ???????????? ??? ??????.) ?? ?? ?????? ?????????? ????? ?? ?????????? – ???? ?? ?? ???????????, ?? ?? ????????? ???????? ?????? ("") ??? ?? ????????? null.

????????? ?????? ????????????, ??? ?? ????? ????? ?????????? ????? ? ????????? Scripts. ??? ???????? Request.MapPath ????? ? ???????? ???????? ??? ???? ??????????. ????? ?? ?????????? ?????????? ????.

@{// ???????? ?????????? ?????? ? ??????? ??????????? ??????????.

var myPathPositional = Request.MapPath("/scripts", "/", true);

<p>@myPathPositional</p>

}

????? ????? ????? ????? ??????????, ?? ?????? ????????? ??? ??? ????? ???????????, ????????? ??????????? ?????????. ??? ?????? ??????, ????????? ??????????? ?????????, ?????????? ??????????? ????? ?????????? ? ????? ????????? (:), ??????????????? ?? ????????. ????????????? ??????????? ?????????? ???????? ??, ??? ?? ?????? ???????? ?? ? ????? ???????. (??????????? ???????? ??, ??? ?????? ???????? ?????? ?????.)

????????? ?????? ???????? ? ??? ?? ?????, ??? ? ????, ?? ?????????? ??????????? ????????? ??? ????????:

@{// ???????? ?????????? ?????? ? ??????? ??????????? ??????????.

var myPathNamed = Request.MapPath(baseVirtualDir: "/", allowCrossAppMapping: true, virtualPath: "/scripts");

<p>@myPathNamed</p>

}

??? ??????, ????????? ?????????? ? ?????? ???????. ??? ?? ?????, ???? ?? ????????? ?????????? ?????? ? ???? ??????, ??? ????? ?????????? ?????????? ????????.

image

?????????????

?????????? ??????? ?????????, ???????????? ????????????? ???????? “??? ?????????”, ?? ?????????? ?????? ? ?????????? ????? ???????????.

??????? ???? ?? WebMatrix, ????? 5. ?????????? ? ??????????? Razor, ????????? ??? ? ASP.NET

??? ??????????? ???????? ????? ?? WebMatrix. ?????????? ????? ??????????? ????? ????? ?????: ??????? ???? ?? WebMatrix, ????? 1. ?????? ?????? ? WebMatrix ? ???-?????????? ASP.NET ??????? ???? ?? WebMatrix, ????? 2. ????????????? ???? ???-??????? ASP.NET ??????? ???? ?? WebMatrix, ????? 3. ????? ??????? ?????? ?? ASP.NET ??????? ???? ?? WebMatrix, ????? 4. ?????????? ? ??????????? Razor. ???????????? ?? ???????????????? ? ???? ????? ?????? ????? ???????? ? ???????????????? ???-??????? ASP.NET ? ???????…(read more)

Useful Dialog Windows with .NET Interop and NAV 2009 R2

We have been asked recently how to display a Dialog window for the RoleTailored client that would collect a Directory path.

The old (good) Codeunit 412 “Common Dialog Management” was not suitable for that purpose (and honestly I would love to go for something more RTC oriented).

I thought myself, then, there may be a lot of useful Dialog windows based on System.Windows.Forms namespace.

  1. How to select a DIRECTORY
  2. How to select a FILE
  3. How to select a COLOR
  4. How to select a PRINTER

Attached you will find 1 unbounded page object in TXT format.

The code is fairly simple.

 

These postings are provided “AS IS” with no warranties and confer no rights. You assume all risk for your use.

Duilio Tacconi (dtacconi)         

Microsoft Dynamics Italy                     

Microsoft Customer Service and Support (CSS) EMEA

- Thanks to Carsten Scholling from Microsoft Dynamics CSS Germany -

??????? ???? ?? WebMatrix, ????? 4. ?????????? ? ??????????? Razor. ???????????? ?? ????????????????

??? ??????????? ???????? ????? ?? WebMatrix. ?????????? ????? ??????????? ????? ????? ?????:

? ???? ????? ?????? ????? ???????? ? ???????????????? ???-??????? ASP.NET ? ??????? ?????????? Razor. ASP.NET — ?????????? ???????? ???-?????????? ? ???-???????? ?? ???????? ??????????, ???????????? ???????????? ??????. ??? ???????? ????????? ?????? ????????? Microsoft .NET ? ????????? ????? ?????? ?????????? Microsoft ASP

8 ???????? ???????????? ?? ????????????????

? ???? ??????? ?????????? ????????? ????????????, ? ???????? ?????????? ????????????, ?????? ??? ?????????? ? ????????? ?????????? ???? ASP.NET ? ?????????????? ?????????? Razor.

??????????. ????????? Razor ??????? ?? ????? ???????????????? C#, ? ?????? ???? ???? ???????????? ? ?????? ???????????. ?????? ????????? Razor ????? ???????????? ???? Visual Basic, ? ???, ??? ????? ???????? ? ?????? ???????????, ????? ????? ??????? ? ? Visual Basic. ?????????????? ???????? ??. ? ?????????? ?????????? VisualBasic ?? ???-????????? ASP.NET.

?????????????? ???????? ? ??????????? ??????????? ??????? ??. ????? ? ???? ?????.

1. ?????????? ???? ?? ???????? ? ??????? ??????? @

? ??????? @ ?????????? ?????????? ????????? ? ?????, ????????? ?? ?????? ??? ?????????? ??????????. ??????? ?? ????? ???????? ???????:

<!– ???? ? ????? ??????????  –>

@{ var total = 7; }

@{ var myMessage = "?????? Razor ? ASP.NET"; }

 

<!– ?????????? ????????? –>

<p>???????? ?????????? total: @total </p>

<p>???????? ?????????? myMessage: @myMessage</p>

 

<!—???? ? ??????????? ??????????? –>

@{

    var greeting = "????? ?????????? ?? ????????!";

    var weekDay = DateTime.Now.DayOfWeek;

    var greetingMessage = greeting + " ???????: " + weekDay;

}

<p>???????????: @greetingMessage</p>

??? ??????? ???????? ? ???????? ??? ????????? ????? ????????? ????????? ???????:

image

2. ?????????? ?????? ???? ? ??????

???? ???? ??????? ?? ?????? ??? ?????????? ?????????? ? ??????????? ? ???????? ??????.

<!– ???? ?? ?????? ?????????. –>

@{ var theMonth = DateTime.Now.Month; }

<p>????? ???????? ??????: @theMonth</p>

<!– ???? ?? ?????????? ??????????. –>

@{

var outsideTemp = 12;

var weatherMessage = "????????????, ??????????? " + outsideTemp + " ????????.";

}

<p>?????? ???????: @weatherMessage</p>

?????????, ??????? ????????? ? ????????:

image

3. ?????????? ??????? ????????? ?????? ????? ?????? ? ???????

?????? ????? ?????? ?????? ???????? ?????? ????????????? ?????? ? ???????. ?????????? ????????? ?? ????????????? ?????? ? ???????. ??? ????? ?? ??????? ??????????? ????:

<!– ???? ?? ?????? ?????????. –>

@{ var theMonth = DateTime.Now.Month; }

<p>????? ???????? ??????: @theMonth</p>

<!– ???? ?? ?????????? ??????????. –>

@{

var outsideTemp = 5;

var weatherMessage = "????????????, ??????????? " + outsideTemp + " ????????.";

}

<p>?????? ???????: @weatherMessage</p>

4. ????????????? ?????????? ??? ???????? ????????

?????????? ????? ???????????? ??? ???????? ?????? ????????, ??????? ??????, ????? ? ????. ????? ?????????? ????????? ? ??????? ????????? ????? var. ?????????? ????? ????????? ??????????????? ?? ???????? ? ??????? ??????? @.

<!– ?????????? ?????? –>

@{ var welcomeMessage = "????? ??????????, ????? ?????????!"; }

<p>@welcomeMessage</p>

<!– ?????????? ???? –>

@{ var year = DateTime.Now.Year; }

<!– ????? ?????????? –>

<p>????? ?????????? ? ????? ????? ????? ??????????, ?????????????? ? @year!</p>

?????????, ??????? ????????? ? ????????:

image

5. ?????????? ????????? ????????? ? ??????? ???????

?????? – ??? ?????????????????? ????????, ??????? ?????????????? ??? ?????. ????? ??????? ??????, ?????????? ????????? ?? ? ??????? ???????:

@{ var myString = "??? ????????? ???????"; }

???? ? ?????? ?????????? ?????? ???????? ????? ????? (\) ??? ??????? ???????, ?? ??????? ????????? ????? ???? ??????? ???????? @, ??????? ????????, ??? ??????????? ??????? ??????? ???????????? ?????????. (? C# ?????? ???????? ????? ????? (\) ????? ?????? ?????, ???? ?? ???????, ??? ??? ??????? ???????????? ?????????).

<!– ????????? ???????? ????? ????? ? ?????? –>

@{ var myFilePath = @"C:\MyFolder\"; }

<p>????: @myFilePath</p>

????? ???????? ? ?????? ??????? ???????, ??????? ???????????? ???????? @, ??????????? ?????????? ????????? ???????, ? ????????? ??????? ??????? ??????:

<!– ????????? ??????? ??????? ? ?????? –>

@{ var myQuote = @"??????? ??????: ""????????????, ??????? ???????????."""; }

<p>@myQuote</p>

?????????, ??????? ????????? ? ????????:

image

??????????. ?????? @ ???????????? ??? ??? ???????? ?????????? ????????? ????????? ? C#, ??? ? ??? ??????? ???? ?? ????????? ASP.NET.

???? ???????? ? ????

? C# ??????????? ??????? ???????? ? ???????? ?????? (var, true, if) ? ?????? ??????????. ? ????????? ??????? ???? ????????? ??? ?????? ??????????, lastName ? LastName.

@{

var lastName = "??????";

var LastName = "??????";

}

???? ?????????? ????????? ? ???? «var lastName = "??????";», ?? ??? ??????? ?????????? ? ???? ?????????? ? ???? «@LastName» ????? ???????? ??????, ????????? ??? LastName ?? ????? ??????????.

??????????. ? Visual Basic ??????? ???????? ?? ???????????.

7. ????????? ? ??? ????????

?????? – ??? ????????, ? ??????? ????? ???????? ??? ????????????????, ???????? ????????, ????????? ????, ????, ???????????, ???-??????, ????????? ??????????? ?????, ?????? ??????? (?????? ???? ??????) ? ?.?. ??????? ????? ????????, ??????????? ?? ????????, ???????? ????????? ???? ????? ???????? Text (?????), ?????? ??????? ????? ???????? URL (URL-?????), ????????? ??????????? ????? ????? ???????? From (??), ? ?????? ????? ???????? FirstName (???). ? ???????? ????? ??????? ??????, ?????????????? ????? «???????», ??????? ????? ????????? ???????. ? ???????? ????, ???????? ??????-???? ? ??????? Save, ??????-??????????? ? ??????? Rotate ? ??????-????????? ??????????? ????? ? ??????? Send.

????? ?????????? ???????? ? ???????? Request (??????), ??????? ????????????? ????? ????????, ??? ???????? ????? ????? ?? ???????? (?.?. ????????? ?????), ??? ????????, ???????????? ??????, URL-????? ????????, ????????????? ???????????? ? ?.?. ? ????????? ??????? ???????????? ??????? ??????? ? ????????? ??????? Request ? ?????? ?????? MapPath ??????? Request ??? ????????? ??????????? ???? ? ???????? ?? ???????:

<table border="1">

<tr>

<td>??????????? URL-?????</td>

<td>????????????? ????</td>

<td>?????? ????</td>

<td>??? HTTP-???????</td>

</tr>

<tr>

<td>@Request.Url</td>

<td>@Request.FilePath</td>

<td>@Request.MapPath(Request.FilePath)</td>

<td>@Request.RequestType</td>

</tr>

</table>

?????????, ??????? ????????? ? ????????:

image

8. ??????????? ????????? ????, ???????????? ???????

???????? ???????????? ???????????? ???-??????? ???????? ??????????? ??????????, ??? ??????? ?????????, ? ??????????? ?? ???????????? ???????. ????? ???????????????? ?????? ??????? ??? ??????? ? ????????????? ????????? if (? ??????????????? ????????? else).

@{

var result = "";

if(IsPost)

{

result = "??? ???????? ???? ?????????? ? ??????? ?????? ?????????.";

}

else

{

result = "??? ??? ?????? ?????? ?????? ????????.";

}

}

<!DOCTYPE html>

<html>

<head>

<title></title>

</head>

<body>

<form method="POST" action="">

<input type="Submit" name="Submit" value="?????????"/>

<p>@result</p>

</form>

</body>

</html>

</body>

</html>

???????? if(IsPost) ???????????? ??????????? ??????? ????????? if(IsPost = true). ?????? ? ?????????? if ?????????? ????????? ???????? ???????? ???????, ?????????? ?????? ???? ? ?.?., ??????? ??????????? ????? ? ???? ?????.

??? ?????????? ??????? ????, ???? ?????? «?????????» ??? ?? ??????????, ?? ?????:

image

?????????, ??????? ????????? ? ???????? ????? ??????? ?????? «?????????»:

image

?????? HTTP GET ? POST ? ???????? IsPost

????????, ???????????? ??? ???-??????? (HTTP), ???????????? ?????? ???????????? ?????????? ??????? («??????») ??? ?????????? ???????? ? ???????. ???????? ????????????????? ???????? ???????? GET, ???????????? ??? ?????? ????????, ? POST, ???????????? ??? ???????? ????????. ??? ???????, ??? ?????? ??????? ????????????? ???????? ??????????? ????? GET. ???? ???????????? ????????? ????? ? ???????? ?????? «?????????», ?? ??????? ????????? ?????? POST ? ???????.

? ???-???????????????? ????? ?????? ??????? ?????, ? ??????? ?????? ??????, GET ??? POST, ????????????? ????????, ????? ?????????? ??????? ????????? ???? ????????. ? ???-????????? ASP.NET ????? ?????????? ????? ??????? GET ??? POST ? ??????? ???????? IsPost. ???? ??????????? ?????? POST, ?? ???????? IsPost ?????????? ???????? true, ? ????? ????????? ????? ????????, ??? ?????? ???????? ????????? ????? ?????. ? ?????? ??????????? ?? ????????? ???????? ???????????? ??????? ????????? ????????, ???????????? ? ??????????? ?? ???????? ???????? IsPost.

?????? ???????? ????

? ???? ????????? ???????????? ?????? ???????? ????????, ?????????????? ??????? ?????? ????????????????. ? ??????? ????????? ????????, ??????? ????????????? ????????????? ??????????? ?????? ??? ?????, ????? ?????????? ?? ? ?????????? ?????????.

  1. ???????? ? ????????? ????? ???? ? ???????? ??? AddNumbers.cshtml.
  2. ?????????? ????????? ??? ? ???????? ? ???????? ?? ? ????????. ??? ????? ???????, ????? ????? ???? ???????? ??? ?? ???????? HTML.

@{

var total = 0;

var totalMessage = "";

if(IsPost) {

// ?????????? ?????, ????????? ?????????????.

var num1 = Request["text1"];

var num2 = Request["text2"];

// ?????????????? ????????? ????? ? ????? ????? ? ?? ????????.

total = num1.AsInt() + num2.AsInt();

totalMessage = "????? = " + total;

}

}

<!DOCTYPE html>

<html>

<head>

<title></title>

<meta http-equiv="content-type" content="text/html;charset=utf-8"/>

<style type="text/css">

body {background-color: beige; font-family: Verdana, Arial;

margin: 50px; }

form {padding: 10px; border-style: solid; width: 250px;}

</style>

</head>

<body>

<p>??????? ??? ????? ????? ? ??????? ?????? <strong>???????</strong>.</p>

<form action=""method="post">

<p><label for="text1">?????? ?????:</label>

<input type="text" name="text1"/>

</p>

<p><label for="text2">?????? ?????:</label>

<input type="text" name="text2"/>

</p>

<p><input type="submit" value="???????" /></p>

</form>

<p>@totalMessage</p>

</body>

</html>

?????? @ ???????? ?????? ???? ???? ? ????????, ? ????? ??????????? ????? ?????????? totalMessage, ??????? ????????? ? ?????? ??????? ????????. ???? ?????? ???????? ???????? ? ???????? ??????. ?????? ?????? ? ???? ????? ????????????? ?????? ? ???????. ??????????? total, num1, num2 ? totalMessage ?????? ???????????? ????? ? ??????. ????????? ???????, ??????????? ?????????? totalMessage, ??????????? ? ??????? ???????. ????????? ? ???? ??????????? ???????, ?????????? totalMessage, ??????????? ????? ????????, ?????? ????? ??????????????? ?????????? ??????.

????????? num1.AsInt() + num2.AsInt() ?????????? ??????? ?????? ? ????????? ? ????????. ????? AsInt ? ?????? ?????????? ??????????? ????????? ????????????? ?????? ? ????? (?????), ????? ????? ???? ????????? ? ??? ?????????????? ????????.

??? <form> ???????? ??????? method="post". ??? ?????????, ??? ??? ??????? ????????????? ?????? «???????» ???????? ????? ???????????? ?? ?????? ? ??????? ?????? HTTP POST. ????? ???????? ????????????, ??????? if(IsPost) ??????????? ??? true, ? ??????????? ???????? ???, ???????????? ????????? ???????? ?????.

????????? ???????? ? ????????? ?? ? ????????. ??????? ??? ????? ????? ? ??????? ?????? «???????».

image

?????????????

?????????? ??????? ?????????, ???????????? ????????????? ???????? “??? ?????????”, ?? ?????????? ?????? ? ?????????? ????? ???????????.

Facebook: few observations

(originally posted on May 14th 2011)
I registered this blog quite a while ago, but never really found the time to regularly post on it. (Of course, the lack of talent to write interesting and useful information is the real reason why thousands of blogs, including this one, have gone stale on the Internet. Lets not publicize that). I created my Facebook account last year. I know I’m late to the party, but hey, better late than never, right? With great frenzy, I added as many friends as possible…(read more)

WhoIs Application

I search for domain names every now and then, especially when a bizarre business idea flashes in my head, my first instinct is to reserve a domain name. (Registering the domain name should really be a lower priority than creating an actual business plan, but being a geek, the “business” part of “running a business” escapes me) Domain name search process looks like this, at least for me: First I connect to a registrar’s web site, search for the name, which will invariably be taken. Then search for…(read more)