13:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.130 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 0 1 100001 0 1 0 1 1 0 1 0 00 0 1 1 1 0 1 100001 0 1 1 100001 13:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.1313:05 ET Dow -154.48 at 10309.92, Nasdaq -37.61 at 2138.44, S&P -19.13

.

.

Saturday, February 26, 2011

Working - Razor Syntax in C Sharp - Web-Based Database - Microsoft Server 2008























@if (!WebSecurity.IsAuthenticated) {
      Response.Redirect("~/Account/Login");
 }

@{
    Layout = "~/_SiteLayout.cshtml";
    PageData["Title"] = "Permitted Users Only";
}

@if ( Roles.IsUserInRole("power")) {
    <span> Welcome <b>@WebSecurity.CurrentUserName</b>! </span>
}
else {
     Response.Redirect("~/UnAuthorized");
}


@{
    var db = Database.Open("snakeConnection");
    var FName = Request["FName"];
    var MName = Request["MName"];
    var LName = Request["LName"];
    var RefBy = Request["RefBy"];
    var Age = Request["Age"];
    var Gender = Request["Gender"];
    var Street = Request["Street"];
    var City = Request["City"];
    var State = Request["State"];
    var Zip = Request["Zip"];
    var Phone1 = Request["Phone1"];
    var Phone2 = Request["Phone2"];
    var Email = Request["Email"];
    var DateVisit = Request["DateVisit"];
    var HABenefit = Request["HABenefit"];
    var BenefitYN = Request["BenefitYN"];
    var HABenWhom = Request["HABenWhom"];
    var IPA = Request["IPA"];
    var HMO = Request["HMO"];
    var CPTCode = Request["CPTCode"];
    var ICD9Code = Request["ICD9Code"];
    var GrossSale = Request["GrossSale"];
    var COGS = Request["COGS"];
    var TDate = Request["TDate"];
    var Brand = Request["Brand"];
    var Model = Request["Model"];
    var PayMethod = Request["PayMethod"];
    var PayPocketAmt = Request["PayPocketAmt"];
    var PayInsAmt = Request["PayInsAmt"];
    var WDamageB = Request["WDamageB"];
    var WDamageE = Request["WDamageE"];
    var WRepairB = Request["WRepairB"];
    var WRepairE = Request["WRepairE"];


    if (IsPost) {

        // Read product name.
        FName = Request["FName"];
        if (FName.IsEmpty()) {
           ModelState.AddError("FName", "First name is required.");
        }

        MName = Request["MName"];
        if (MName.IsEmpty())
        {
            ModelState.AddError("MName", "Middle name is required.");
        }

        // Read product description.
        LName = Request["LName"];
        if (LName.IsEmpty()) {
          ModelState.AddError("LName",
                "Last Name is required.");
         }

        // Read product price
        RefBy = Request["RefBy"];
        if (RefBy.IsEmpty()) {
          ModelState.AddError("RefBy", "Referred by is required.");
        }

        // Define the insert query. The values to assign to the
        // columns in the Product table are defined as parameters
        // with the VALUES keyword.
        if(ModelState.IsValid) {
            var insertQuery1 = "INSERT INTO dbo.Patients (FName, MName, LName, RefBy, Age, Gender, Street, City, State, Zip, Phone1, Phone2, Email) " +
                "VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12)";
            db.Execute(insertQuery1, FName, MName, LName, RefBy, Age, Gender, Street, City, State, Zip, Phone1, Phone2, Email);
            var insertQuery2 = "INSERT INTO dbo.Referrals (LName, RefBy, DateVisit, HABenefit, HABenWhom, IPA, HMO, CPTCode, ICD9Code) " +
                "VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8)";
            db.Execute(insertQuery2, LName, RefBy, DateVisit, HABenefit, HABenWhom, IPA, HMO, CPTCode, ICD9Code);
            var insertQuery3 = "INSERT INTO dbo.financials (LName, GrossSale, COGS, TDate, Brand, Model, PayMethod, PayPocketAmt, PayInsAmt, WDamageB, WDamageE,   WRepairB, WRepairE) " + "VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12)";
            db.Execute(insertQuery3, LName, GrossSale, COGS, TDate, Brand, Model, PayMethod, PayPocketAmt, PayInsAmt, WDamageB, WDamageE, WRepairB, WRepairE);
        }
    }
}


    <form method="post" action="">
    <table width="900" border="1">
    <tr>
    <td width="225"><h3 align="center">Patient</h3></td>
    <td width="225">
            <h3 align="center"><input type="submit" value="Submit" class="submit" style="color: Blue; width: 75; height: 35;"/></h3></td>
    <td width="225"><h3 align="center">Insurance</h3></td>
    <td width="225"><h3 align="center">Financials</h3></td>
    </tr>
    </table>
    <table width="900" border="1">
  <tr>
    <td width="150px">First Name</td>
    <td width="150px">
       <input type="text" name="FName" value="" />
      </td>
    <td width="150px">Date of Visit</td>
    <td width="150px"> <input type="text" name="DateVisit" value="" /></td>
    <td width="150px">Transaction Date</td>
    <td width="150px"><input type="text" name="TDate" value="" /></td>
  </tr>
  <tr>
    <td width="150px">Middle Name</td>
    <td width="150px"><input type="text" name="MName" value="" /></td>
    <td width="150px">Hearing Aid Benefit</td>
    <td width="150px"><input type="text" name="HABenefit" value="" /></td>
    <td width="150px">Gross Sale</td>
    <td width="150px"><input type="text" name="GrossSale" value="" /></td>
  </tr>
  <tr>
    <td width="150px">Last Name</td>
    <td width="150px"><input type="text" name="LName" value="" /></td>
    <td width="150px">Benefit By Whom</td>
    <td width="150px"> <input type="text" name="HABenWhom" value="" /></td>
    <td width="150px">COGS</td>
    <td width="150px"><input type="text" name="COGS" value="" /></td>
  </tr>
  <tr>
    <td width="150px">Referred By</td>
    <td width="150px"><input type="text" name="RefBy" value="" /></td>
    <td width="150px">Insurer</td>
    <td width="150px"><input type="text" name="HMO" value="" /></td>
    <td width="150px">Brand</td>
    <td width="150px"><input type="text" name="Brand" value="" /></td>
  </tr>
  <tr>
    <td width="150px">Birth Date</td>
    <td width="150px"><input type="text" name="Age" value="" /></td>
    <td width="150px">IPA</td>
    <td width="150px"><input type="text" name="IPA" value="" /></td>
    <td width="150px">Model</td>
    <td width="150px"><input type="text" name="Model" value="" /></td>
  </tr>
  <tr>
    <td width="150px">Gender</td>
    <td width="150px"><input type="text" name="Gender" value="" /></td>
    <td width="150px">CPT Code</td>
    <td width="150px"><input type="text" name="CPTCode" value="" /></td>
    <td width="150px">Payment Method</td>
    <td width="150px"><input type="text" name="PayMethod" value="" /></td>
  </tr>
  <tr>
    <td width="150px">Street</td>
    <td width="150px"><input type="text" name="Street" value="" /></td>
    <td width="150px">ICD9/10 Code</td>
    <td width="150px"><input type="text" name="ICD9Code" value="" /></td>
    <td width="150px">Out of Pocket</td>
    <td width="150px"><input type="text" name="PayPocketAmt" value="" /></td>
  </tr>
  <tr>
    <td width="150px">City</td>
    <td width="150px"><input type="text" name="City" value="" /></td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">Insurance Portion</td>
    <td width="150px"><input type="text" name="PayInsAmt" value="" /></td>
  </tr>
  <tr>
    <td width="150px">State</td>
    <td width="150px"><input type="text" name="State" value="" /></td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">WarrantyD Begin</td>
    <td width="150px"><input type="text" name="WDamageB" value="" /></td>
  </tr>
  <tr>
    <td width="150px">Zip</td>
    <td width="150px"><input type="text" name="Zip" value="" /></td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">WarrantyD End</td>
    <td width="150px"><input type="text" name="WDamageE" value="" /></td>
  </tr>
  <tr>
    <td width="150px">Phone1</td>
    <td width="150px"><input type="text" name="Phone1" value="" /></td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">WarrantyR Begin</td>
    <td width="150px"><input type="text" name="WRepairB" value="" /></td>
  </tr>
  <tr>
    <td width="150px">Phone2</td>
    <td width="150px"><input type="text" name="Phone2" value="" /></td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">WarrantyR End</td>
    <td width="150px"><input type="text" name="WRepairE" value="" /></td>
  </tr>
  <tr>
    <td width="150px">Email</td>
    <td width="150px"><input type="text" name="Email" value="" /></td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
  </tr>
  <tr>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
  </tr>
  <tr>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
  </tr>
  <tr>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
  </tr>
  <tr>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
  </tr>
  <tr>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
  </tr>
  <tr>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
    <td width="150px">&nbsp;</td>
  </tr>

</table>
 </form>