A Simple ASP.Net Form in C#. Payment Information Collection Form #.Net Web Applications

Brought from our old site: http://salearningschool.com/displayArticle.php?table=Articles&articleID=1350&title=A%20Simple%20ASP.Net%20Form%20in%20C#.%20Payment%20Information%20Collection%20Form.

A Simple ASP.Net Form in C#. Payment Information Collection Form.

Such forms can be used to test payment processing API/Service before actually integrating. The input fields are to send data to the payment gateway. The response fields are to display response from payment gateway. Here, the output fields represent the response fields as sent by Paymentech gateway.

The Form

The CSS

Front end form code
From: http://sitestree.com/?p=3740
Categories:.Net Web Applications
Tags:
Post Data:2016-07-16 12:10:40

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Allow Page Access only to the Logged in Users #.Net Web Applications

Brought from our old site: http://salearningschool.com/displayArticle.php?table=Articles&articleID=1349&title=Allow%20Page%20Access%20only%20to%20the%20Logged%20in%20Users

Allow Page Access only to the Logged in Users

From: http://sitestree.com/?p=3736
Categories:.Net Web Applications
Tags:
Post Data:2016-07-16 12:02:56

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Creating your own Classes in C# in ASP.net #.Net Web Applications

Brought from our old site: http://salearningschool.com/displayArticle.php?table=Articles&articleID=1348&title=Creating%20your%20own%20Class%20in%20C#%20in%20ASP.net

Creating your own Class in C# in ASP.net

  • It is kind of simple. You need to create a class library. The class library will create a dll file. From your project, you need to add reference to the dll file. Then you will be able to use the classes and methods of the class library.
  • Check the following code. One is a sample class library and another one is how to use the class. The class library implements two methods such as add and subtract (to add or subtract two numbers). The project uses the namespace [class library] and calls these methods
  • You can get the dll file in the bin/debug or bin/release folder under your class library project
  • You can right click on your project/website [in solution explorer], and click Add Reference, then click browse and select the dll file created
  • Check the class library below
  • Check the Form in picture. This form uses the class library.
  • Check the Form Code to use the Library
  • Check the Backend Form Code to use the Library

From: http://sitestree.com/?p=3733
Categories:.Net Web Applications
Tags:
Post Data:2016-07-16 11:56:21

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Simple Ajax Applications in C# (ASP.Net) #.Net Web Applications

Brought from: http://salearningschool.com/displayArticle.php?table=Articles&articleID=1347&title=Simple%20Ajax%20Applications%20in%20C#%20(ASP.Net)

Simple Ajax Applications in C# (ASP.Net)

Note:asmx web-service might be more appropriate in some/many cases

  • If you are coming from PHP or Java Platform where you use JavaScript or jQuery to provide Ajax functionality, you still can use those strategies in ASP.net to provide Ajax functionality
  • Check our short note on Ajax using JavaScript. In .Net, you just have to call the JavaScript function (that implements Ajax functionality) on the event you want the Ajax functionality. However, you do not use runat=”server”.
  • Another approach is Using Ajax Server Controls such as ScriptManager, ScriptManagerProxy, UpdatePanel, ContentPanel, UpdateProxy
  • You can find these Ajax controls at the Toolbox under Ajax Extensions
  • You can grab them and place on your form, you can grab and place on the code, or you can write them in your code [whatever you are used to]
  • And yes, you could use JQuery as well. JQuery uses a wrapper on JavaScript functionality and makes the life of the developer way easier
  • In this short note, I will show a simple example of using Ajax Server Controls, also show you the code to invoke Ajax functionality using JavaScript
  • Now take a look at the simple application interface below. The application will calculate sum, difference, and multiplication of two numbers without refreshing the page. We will calculate immediately, also will show the situation when the calculation may take a little more time
  • The idea is simple, you need to add a ScriptManager control. If you use master pages, and the situation becomes that you need to place two ScriptManagers, just place one ScriptManager in the Master and use ScriptManagerProxy in the content page
  • use UpdatePanel around the controls that will be refreshed without the page being refreshed
  • Use UpdateProgress control, when you know that the operation will take some time. Use this control to inform the user that the operation is under progress
  • Now the sample application interface
  • Now the Form code
  • Now the backend code
  • Now an example on how to implement Ajax functionality in C# in ASP.net using JavaScript. It just displays current date time but using Ajax and without refreshing the page. Just go through the code

From: http://sitestree.com/?p=3731
Categories:.Net Web Applications
Tags:
Post Data:2016-07-16 11:28:51

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

ASP.Net Validation Control Examples in C# #.Net Web Applications

Brought from: http://salearningschool.com/displayArticle.php?table=Articles&articleID=1325&title=ASP.Net%20Validation%20Control%20Examples%20in%20C#.

ASP.Net Validation Control Examples. Just check the code below

Some notes

  • RequiredFieldValidator: is used to check that a field is filled up
  • CompareValidator: Compare the value of a field with another field or data
  • RangeValidator: Compares the data is within a given range
  • RegularExpressionValidator: Domain name syntax, email addtress syntax
  • ValidationSummary: Display all validation errors in a summary box
  • CompareValidator: Write your own custom validation rules and display the outcome
  • Remember
    • You can display error on the side of the control
    • You can display error under the control
    • The example used both just for example
    • The Text property is the output that comes just where the validation control is placed. ErrorMessage propert is for the ValidationSummary
    • If you just want the Validation Summary output, use Display=”none” for the validation control (not the summarycontrol) itself
  • the code can be seen at http://salearningschool.com/samples/validate.txt as well
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="validation.aspx.cs" 
Inherits="validation" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Validation Control</title>
</head>
<body>   


    <form id="form1" runat="server">
    <div>


        <asp:ValidationSummary ID="ValidationSummary1"
            HeaderText="Form Validation Summary"
            DisplayMode="BulletList"
            EnableClientScript="true"
             ForeColor = "Red"
            runat="server"
        />

        <asp:Label ID="lblFirstName" runat="server" Text="First Name:" 
        Width="120"></asp:Label>
        <asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>

        <asp:RequiredFieldValidator ID="firstNameValidator"
             ControlToValidate="txtFirstName"
             ErrorMessage="First Name Required"
             InitialValue=""
             Text=""
             Display ="None"
             runat="server"/>

        <br />

        <asp:Label ID="lblLastName" runat="server" Text="Last Name" Width="120">
        </asp:Label>
        <asp:TextBox ID="txtLastName" runat="server"></asp:TextBox>
        <br/>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
             ControlToValidate="txtLastName"
             ErrorMessage="Last Name Required"
             InitialValue=""
             Text="Last Name Required"            
             ForeColor="Red"
             runat="server"/>

         <br />

        <asp:Label ID="lblEmail" runat="server" Text="Email:" Width="120">
        </asp:Label>
        <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>

        <asp:RegularExpressionValidator ID="emailValidation" 
            runat="server" 
            ControlToValidate="txtEmail" 
            ErrorMessage="Invalid Fformat"              
            ValidationExpression="^([a-zA-Z][w.-]*[a-zA-Z0-9]@[a-zA-Z0-9][w.-]*[a-zA-Z0-9]
            .[a-zA-Z][a-zA-Z.]*[a-zA-Z]){1,70}$"
            ForeColor ="Red"            
         />
             
        <br />

        <asp:Label ID="lblPassword" runat="server" Text="Password" Width="120">
        </asp:Label>
        <asp:TextBox ID="txtPassword" runat="server" TextMode="Password">
        </asp:TextBox>
        <br />

        <asp:Label ID="lblPassword2" runat="server" Text="Re Enter Password" Width="120">
        </asp:Label>
        <asp:TextBox ID="txtPassword2" runat="server" TextMode="Password">
        </asp:TextBox>
        <br />

         <asp:CompareValidator ID="compareV" ControlToValidate="txtPassword" 
         ControlToCompare="txtPassword2" runat="server" Text="mismatchmatch" 
         ForeColor="Red" />

        <br />

        <asp:Button ID="btnSubmit" runat="server" OnClick="Button1_Click" Text="Submit" />

    </div>        
    </form>
</body>
</html>

From: http://sitestree.com/?p=3729
Categories:.Net Web Applications
Tags:
Post Data:2016-07-16 11:12:48

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

#Engineering: #Canada: #Job/Contract/Project: Any #Engineering: #Computer, #Electrical, #Electronics, #Civil, #Chemical, #Mechanical, #Naval, #Biomedical, and misc Engineering

Date Posted:2021-09-01 .Apply yourself, or submit others as candidates; Build a recruitment team to submit others as candidates; submit RFP to be considered for projects in future; Try to become a vendor so that you are asked to submit consultants/resources in future. If these work for you. This list is posted in this blog everyday provided there are new projects under the criteria

  1. air-conditioning-and-refrigeration-equipment-10016
  2. MECHANICAL COOLING ADDITION
  3. Supply And Installation Of Heating, Ventilation And Air Conditioning (Hvac) System Replacement, Electrical Upgrades
  4. communications-detection-and-fibre-optics-10031
  5. Electrical Consulting Services
  6. Upgrade Electrical Panels – Tender Ready
  7. construction-products-10032
  8. Electrical Consulting Services
  9. Upgrade Electrical Panels – Tender Ready
  10. electrical-and-electronics-10006
  11. Electrical Consulting Services
  12. food-preparation-and-serving-equipment-10012
  13. Electrical Upgrade
  14. industrial-equipment-10014
  15. The Seasonal Lease of Mechanical Sweepers
  16. machinery-and-tools-10015
  17. Upgrade Electrical Panels – Tender Ready
  18. textiles-and-apparel-10028
  19. Electrical Consulting Services
  20. Upgrade Electrical Panels – Tender Ready
  21. transportation-equipment-and-spares-10029
  22. The Seasonal Lease of Mechanical Sweepers
  23. architect-and-engineering-services-10048
  24. Engineering Services for Gladstone Avenue and Dovercourt Street Sewer Separation – Community of Chatham
  25. Engineering Services for Detailed Design and Contract Administration of Queensway Trunk Sewer Rehabilitation, Project 20-2443
  26. Engineering Services for the PRFN Bridge Replacement and Associated Works
  27. Engineering Consultant Services for Upgrades to Wastewater Treatment System at Lac Des Iles
  28. Vendor of Record – Electrical Engineering Consulting Services
  29. Engineering Consulting Services for Tenant Renovation
  30. Sewer Separation Program- Bayers Road Pocket and Bayne Street Stormwater Study- Engineering Services
  31. Consultant Engineering Services – Water Systems Reinforcement
  32. Engineering Support Services (F7044-190233/C)
  33. communications-photographic-mapping-printing-and-publication-services-10042
  34. Electrical Consulting Services
  35. Upgrade Electrical Panels – Tender Ready
  36. custodial-operations-and-related-services-10037
  37. Electrical Consulting Services
  38. environmental-services-10050
  39. Electrical Consulting Services
  40. Engineering Services for the Design of Former Rossville School Site Remediation
  41. Upgrade Electrical Panels – Tender Ready
  42. information-processing-and-related-telecommunications-services-10049
  43. Electrical Consulting Services
  44. maintenance-repair-modification-rebuilding-and-installation-of-goods-equipment-10054
  45. Upgrades to Victory School Building Mechanical System
  46. research-and-development-r-d-10036
  47. Engineering Consulting Services for Detailed Dam Break Flood Inundation Mapping
  48. utilities-10041
  49. Electrical Consulting Services
  50. Upgrade Electrical Panels – Tender Ready
  51. Request for Proposal for Engineering Services – 2021/2022 Active Transportation Plan
  52. undefined-10055
  53. Upgrades to Victory School Building Mechanical System
  54. Keywords Used:engineer,civil,mechanical,electrical,electronics,mechatronics,naval,biomedical,computer engineer,software engineer,civil engineer,biomedical,electrical engineer,electronics engineer,mechanical engineer,metallurgical,chemical engineer,industrial engineer,communications engineer,quality assurance engineer,Aerospace engineer,aeronautical engineer,Engineering manager,Agricultural Engineer,Automotive Engineer,Environmental Engineer,Geological Engineer,Marine Engineer,Petroleum Engineer,Acoustic Engineer,Acoustic Engineer,Aerospace Engineer,Agricultural Engineer,Applied Engineer,Architectural Engineer,Audio Engineer,Automotive Engineer,Biomedical Engineer,Chemical Engineer,Civil Engineer,Computer Engineer,Electrical Engineer,Environmental Engineer,Industrial Engineer,Marine Engineer,Materials Science Engineer,Mechanical Engineer,Mechatronic Engineer,Mining and Geological Engineer,Molecular Engineer,Nanoengineering,Nuclear Engineer,Petroleum Engineer,Software Engineer,Structural Engineer,Telecommunications Engineer,Thermal Engineer,Transport Engineer,Vehicle Engineer,engineering

    #Canada: #IT Jobs:#Consultants, #Contractors, #Analysts, #Engineers, #Developers, #Technology Consultants, #IT-Consultants Opportunities2021-09-01

    Apply yourself, or submit others as a candidate, Build a recruitment team to submit others as a candidate, submit RFP to be considered for projects in future, Try to become a vendor so that you are asked to submit consultants/resources in future

    1. communications-detection-and-fibre-optics-10031
    2. Electrical Consulting Services
    3. construction-products-10032
    4. Electrical Consulting Services
    5. edp-and-office-equipment-maintenance-10035
    6. Drupal Based Cloud Hosted Web Content Management System
    7. electrical-and-electronics-10006
    8. Electrical Consulting Services
    9. energy-10007
    10. Advocate Cost Consulting Services for 45 Sacré-Coeur Blvd. Project
    11. machinery-and-tools-10015
    12. Consultant – LAS – Assessment (Design & Construction Phase)
    13. textiles-and-apparel-10028
    14. Electrical Consulting Services
    15. RFP #21.0054 Integrated Project Delivery Team – Turf Consultant and Turf Contractor for the Indoor Fieldhouse
    16. architect-and-engineering-services-10048
    17. Engineering Consultant Services for Upgrades to Wastewater Treatment System at Lac Des Iles
    18. Consulting Services Feasibility of Building Renovation
    19. Vendor of Record – Electrical Engineering Consulting Services
    20. Engineering Consulting Services for Tenant Renovation
    21. Consultant Engineering Services – Water Systems Reinforcement
    22. communications-photographic-mapping-printing-and-publication-services-10042
    23. Electrical Consulting Services
    24. custodial-operations-and-related-services-10037
    25. Electrical Consulting Services
    26. educational-and-training-services-10043
    27. Human Resources and Organizational Development Consulting Services
    28. Space standards consultant for the university sector
    29. Medical Consulting Services for the Assured Income for the Severely Handicapped (AISH) Program for the of Alberta
    30. environmental-services-10050
    31. Electrical Consulting Services
    32. financial-and-related-services-10038
    33. Prime Consultant for Design Services – Roofing Specialization
    34. P01AD21429 – CONSULTING SERVICES FOR RETAIL STRATEGY DEVELOPMENT
    35. health-and-social-services-10052
    36. HCP Psychology Consultant Services
    37. information-processing-and-related-telecommunications-services-10049
    38. Electrical Consulting Services
    39. TBIPS – Business Consultant (R000094950)
    40. maintenance-repair-modification-rebuilding-and-installation-of-goods-equipment-10054
    41. RFP to Hire a Consultant to Assist in Determining Wastewater Treatment Upgrades for Bob's Lake Lagoon & Whitney-Tisdale Water Pollution Control Plant
    42. operation-of-government-owned-facilities-10039
    43. Professional Food Consulting Services (RE-POSTED)
    44. professional-administrative-and-management-support-services-10040
    45. Project: tender_15419 – LHLS03883 – Facility Location Consultant – London Hospital Linen Service Inc.
    46. Toxicology Consulting
    47. Toxicology Consulting
    48. Growth management strategy, consulting services
    49. Service Delivery and Operations Review Consultant
    50. Request for Proposal for the Provision of A Climate Change Action Consultant
    51. quality-control-testing-inspection-and-technical-representative-services-10053
    52. Consulting & Inspection Services Manitoba Personal Care Home (PCH) HVAC Systems
    53. Consulting Services for Drone Inspection Studies of Halton Region Open and Closed Landfill Sites
    54. REQUEST FOR PROPOSAL (RFP) for THIRD PARTY MATERIAL TESTING CONSULTANT SERVICES for NEW EDMONTON HOSPITAL PROJECT – CAMPUS SITE WORKS
    55. research-and-development-r-d-10036
    56. Professional Consulting Service for Compensation & Job Description Review Projec
    57. Engineering Consulting Services for Detailed Dam Break Flood Inundation Mapping
    58. special-studies-and-analysis-not-r-d-10047
    59. Space standards consultant for the university sector
    60. Consulting Services for Feasibility Study and Public Benefit Review for a Vacant Home Tax in Halton Region
    61. Consulting Services for Landfill Infrastructure Condition Assessments at Halton Region Open and Closed Landfill Sites
    62. P01AD21429 – CONSULTING SERVICES FOR RETAIL STRATEGY DEVELOPMENT
    63. utilities-10041
    64. Consulting & Inspection Services Manitoba Personal Care Home (PCH) HVAC Systems
    65. Electrical Consulting Services
    66. Manipulating Configuration Parameters: For example Variables in web.config #.Net Web Applications

      Brought from (our old site): http://salearningschool.com/displayArticle.php?table=Articles&articleID=1324&title=Manipulating%20Configuration%20Parameters:%20For%20example%20Variables%20in%20web.config

      To access a variable value, you can use the following type of code

         string statusr = WebConfigurationManager.AppSettings["userLoginStatus"].ToString();
      
         You will need to use: using System.Web.Configuration; or you can write as follows:
         string statusr = 
         System.Web.Configuration.WebConfigurationManager.AppSettings["userLoginStatus"].ToString();
      

      What about if you want to change the values of the variables in the web.config file. Check the code below:

      
      //Compiled
      Configuration myConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
      
      //change values for the variables in the AppSettings section
      myConfig.AppSettings.Settings["userLoginStatus"].Value = "1";
      
      //change values for the connection strings section
      myConfig.ConnectionStrings.ConnectionStrings["myDatabaseName"].ConnectionString = 
         "Data Source=....";
      
      myConfig.Save();
      
      //will return you the new value
      string statusr = WebConfigurationManager.AppSettings["userLoginStatus"].ToString();
      
      

      The above code used:
      System.Web.Configuration;
      using System.Configuration;

      From: http://sitestree.com/?p=3726
      Categories:.Net Web Applications
      Tags:
      Post Data:2016-07-16 11:06:25

          Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
          (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
          In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
          <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
          8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
          Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
          Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>
      

      Random C# and MS SQl Server #.Net Web Applications

      Brought from: http://salearningschool.com/displayArticle.php?table=Articles&articleID=1321&title=Random%20C#%20and%20MS%20SQl%20Server

      Foreign Key in Table Declaration

      
      CREATE TABLE ORDERS (
         ID integer primary key, 
         Order_Date datetime, 
         Customer_ID integer references CUSTOMER(ID), 
         Amount double
      ); 
      
      ALTER TABLE ORDERS ADD FOREIGN KEY (customer_id) REFERENCES CUSTOMER(ID);
      
      

      Stored Procedure Example

          CREATE PROCEDURE [dbo].[procedure_name]
            @param1 VARCHAR(100)
           ,@param2 VARCHAR(200) OUTPUT
          AS
          BEGIN
             DECLARE @param3 VARCHAR(100)
             SET @param3 = ' '
             IF @param1 IS NOT NULL AND LEN(@param1) > 1
                  SELECT @param2 = 'The ' + @param1  + @param3
              ELSE 
                  SELECT  @param2 = '...is cool!'
              RETURN
          
          END
          GO
      

      C# and Prepared Statements

           
           int  id = 20;
           string  desc = "...." ;
           SqlConnection rConn = new SqlConnection("Persist Security Info=False;Integrated Security=SSPI;
              database=northwind;server=mySQLServer");
           rConn.Open();
           SqlCommand command = new SqlCommand(null, rConn);
      
           // Create and prepare an SQL statement.
           command.CommandText = "insert into Region (ID, Description) values (@id, @desc)" ;
           command.Parameters.Add ( "@id", id) ;
           command.Parameters.Add ( "@desc", desc) ;
           command.Prepare() ;  // Calling Prepare after having set the Commandtext and parameters.
           command.ExecuteNonQuery();
      
           // Change parameter values and call ExecuteNonQuery.
           command.Parameters[0].Value = 21;
           command.Parameters[1].Value = "mySecondRegion";
           command.ExecuteNonQuery();
      
         conn = new SqlConnection(strConnectionString);
         SqlCommand cmd = new SqlCommand();
         cmd.CommandText ="insert into Profile values(@Name,@Age)";
         cmd.Connection = conn;
         cmd.CommandType = CommandType.Text;
      
         SqlParameter nameP = new SqlParameter();
         nameP.SqlDbType =SqlDbType.NVarChar;
         nameP.ParameterName = "@Name";
         nameP.Size = 50;
         nameP.Value = model.Name;
      
         SqlParameter ageP = new SqlParameter();
         ageP.SqlDbType =SqlDbType.Int;
         ageP.ParameterName = "@Age";
         ageP.Value = model.Age;
      
         cmd.Parameters.Add(nameP);
         cmd.Parameters.Add(ageP);
      
         conn.Open();
         cmd.Prepare(); 
      
         cmd.ExecuteNonQuery();
      
      

      C# and Stored Procedure

             conn = new SqlConnection("Server=(local);DataBase=Northwind;Integrated Security=SSPI");
             conn.Open();
      
             SqlCommand cmd  = new SqlCommand("sp_name", conn);
      
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.Add(new SqlParameter("@CustomerID", custId));
      
             // execute the command
             rdr = cmd.ExecuteReader();
      
             // iterate through results, printing each to console
             while (rdr.Read())
             {
                Console.WriteLine("" + rdr["Total"] );
             }
      
      

      From: http://sitestree.com/?p=3724
      Categories:.Net Web Applications
      Tags:
      Post Data:2016-07-16 11:01:19

          Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
          (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
          In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
          <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
          8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
          Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
          Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>
      

      Razor, Web-page Model, Web-Application Development in C# #.Net Web Applications

      Brought from: http://salearningschool.com/displayArticle.php?table=Articles&articleID=1320&title=Razor,%20Web-page%20Model,%20Web-Application%20Development%20in%20C# (written long back)

      Razor, Web-page Model, Web-Application Development in C#

      • Razor:a markup syntax to add server side code into ASP.net pages
      • Razor example: Current time is @DateTime.Now
      • Razor Code Syntax
                   
                 Single statement block
             @{ var message = "Hello World"; }
        
            Inline expression or variable
            The message: @message
        
            Multi-statement block
            @{
                var greeting = "Hello";
                var currentTime = DateTime.Now;
                var greetMessage = greeting + " Current time is: " + currentTime;
            }
            The greeting is: @greetMessage
            
      • Some Razor functions mainly used in the Layout file [can be used in other files based on the function]: RenderPage() – render the content of a page, RenderBody(), RenderSection(section) – render the content of a section named section
      • using _ at the beginning of a web-page name prevents it from being browsed from browser such as _header.cshtml, _Layout.cshtml
      • In ASP.net, you can hide sensitive information by using the _AppStart.cshtml file. Here, you can keep database passwords, and email passwords. You can also keep your webmail server configuration.
      • _AppStart.cshtm example
              
                          @{
                    WebMail.SmtpServer = "smtp.bizmail.yahoo.com";
                    WebMail.EnableSsl = true;
                    WebMail.UserName = "sayed@justetc.net";
                    WebMail.Password = "password";
                    WebMail.From = "sayed@justetc.net";
                }
                    
      • Some folders as used in ASP.net web applications: App_Data – to keep database files, Images – image files, Scripts – JavaScript files for example, Shared – common files such as CSS files
      • In a file path, ~ is used to indicate the virtual root folder.
      • Server.MapPath, can convert a virtual path to a physical path
      • @Href(cssPath), here cssPath is a variable for a path. You can use Href(cssPath) for the value of href attributes
      • Page object methods: href (builds a url), RenderBody(), RenderPage(page), RenderSection(section), Write (object) – HTML Encoded string, WriteLiteral – No HTML encoding
      • Page object properties: isPost, Layout, Page, Request, Server
      • You can add properties to the Page object such as Page.Title; here Title is your own variable [not built in]
      • Read from a physical file: File.ReadAllLines(filePath). You may want to use var filePath = Server.MapPath(“~/file.txt”);, to get the physical path from a virtual path
      • File.ReadAllLines(filePath), can also be used to read excel csv files [comma delimited]
      • Some ASP.net helpers: Helpers are just components. WebGrid, Chart, WebMail, and WebImage are some common helpers
      • WebGrid helper example: webGrid = new WebGrid (data); grid.getHtml(); data for example can be the rows of a database table, GetHtml () – will render the data as a HTML table.
      • Chart example
                        @{
                            var db = Database.Open("dbName");
                            var dbdata = db.Query("SELECT Name, Price FROM Product");
                            var myChart = new Chart(width: 600, height: 400)
                               .AddTitle("Product Sales")
                               .DataBindTable(dataSource: dbdata, xField: "Name")
                               .Write();
                    }
        
                    
      • The above example will create bar chart [column chart]
      • if you want a pie chart as output, use .AddSeries(chartType:”Pie” in the above example
      • You can use an Array, or XML data as the data feed for the Chartff
      • Sending emails: WebMail.Send(to:”xyz@xyz.com”, subject: “Email from – ” + customerEmail, body: request
      • Publish your web-site: Use the publish option from your IDE (Webmatrix, Visual Studio for Web)
      • Manual publish: Make sure that the server side has the compatible ASP.net framework, copy all of your folders and files, copy the DLL files into the bin folder, copy SQL server DLL files, copy the database if appropriate

      From: http://sitestree.com/?p=3720
      Categories:.Net Web Applications
      Tags:
      Post Data:2016-07-16 10:49:27

          Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
          (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
          In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
          <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
          8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
          Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
          Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>