protected void AddBranch(object sender, EventArgs e)
 {
     Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('foo')", true);
     if (Page.IsValid)
     {
         DBHandler.DBHandler db = new DBHandler.DBHandler(con);
         Entities.Campus c1 = new Entities.Campus()
         {
             campusName = CampusName.Value,
             address = address.Value,
             zipCode = Convert.ToInt32(ZipCode.Value.ToString()),
             phone1 = Phone1.Value,
             phone2 = Phone2.Value,
             phone3 = Phone3.Value,
             principal = PrincipalName.Value,
             email = CEmail.Value,
             isActive = CCheck.Checked,
         };
         Entities.ZipCodes z1 = new Entities.ZipCodes()
         {
             zipCode = Convert.ToInt32(ZipCode.Value.ToString()),
             cityName = CityName.Value,
         };
         db.InsertBranch(c1, z1);
         Clabel.Text = "Campus Added Successfully";
     }
 }
Exemple #2
0
 protected void AddBranch(object sender, EventArgs e)
 {
     Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('foo')", true);
     if (Page.IsValid)
     {
         DBHandler.DBHandler db = new DBHandler.DBHandler(con);
         Entities.Campus     c1 = new Entities.Campus()
         {
             campusName = CampusName.Value,
             address    = address.Value,
             zipCode    = Convert.ToInt32(ZipCode.Value.ToString()),
             phone1     = Phone1.Value,
             phone2     = Phone2.Value,
             phone3     = Phone3.Value,
             principal  = PrincipalName.Value,
             email      = CEmail.Value,
             isActive   = CCheck.Checked,
         };
         Entities.ZipCodes z1 = new Entities.ZipCodes()
         {
             zipCode  = Convert.ToInt32(ZipCode.Value.ToString()),
             cityName = CityName.Value,
         };
         db.InsertBranch(c1, z1);
         Clabel.Text = "Campus Added Successfully";
     }
 }
Exemple #3
0
 public void InsertBranch(Entities.Campus c1, Entities.ZipCodes z1)
 {
     using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spInsertBranch]"))
     {
         s1.AddParameter("@campusName", System.Data.SqlDbType.NVarChar, c1.campusName);
         s1.AddParameter("@address", System.Data.SqlDbType.NVarChar, c1.address);
         s1.AddParameter("@zipCode", System.Data.SqlDbType.Int, c1.zipCode);
         s1.AddParameter("@phone1", System.Data.SqlDbType.NVarChar, c1.phone1);
         s1.AddParameter("@phone2", System.Data.SqlDbType.NVarChar, c1.phone2);
         s1.AddParameter("@phone3", System.Data.SqlDbType.NVarChar, c1.phone3);
         s1.AddParameter("@principal", System.Data.SqlDbType.NVarChar, c1.principal);
         s1.AddParameter("@cityName", System.Data.SqlDbType.NVarChar, z1.cityName);
         s1.AddParameter("@email", System.Data.SqlDbType.NVarChar, c1.email);
         s1.AddParameter("@isActive", System.Data.SqlDbType.Bit, c1.isActive);
         s1.Execute();
     }
 }