Exemple #1
0
 protected void ButtonRegister_Click(object sender, EventArgs e)
 {
     try
     {
         if (IsValidData())
         {
             ErpDataContext db    = new ErpDataContext();
             string         strId = HiddenField1.Value.ToString();
             Int32          Id;
             if (!String.IsNullOrEmpty(strId))
             {
                 var IdResult = db.GetAcountId(strId).ToList();
                 Id = System.Convert.ToInt32(IdResult[0].Id);
                 db.UpdateAccountDetail(TextBoxSupName.Text, DropDownListGender.SelectedValue.ToString(), TextBoxAddress.Text, TextBoxCity.Text, TextBoxState.Text, TextBoxZipCode.Text, DropDownListCountry.SelectedItem.ToString(), TextBoxSupPhno.Text, TextBoxEmail.Text, TextBoxGSTNo.Text, Id);
                 Globals.MessageBoxShow(this, "Updated Successfully");
                 ButtonRegister.Text = "Register";
                 Clear();
             }
             else
             {
                 db.SpAccountdetail(strDisplayName, TextBoxSupName.Text, DropDownListGender.SelectedValue.ToString(), TextBoxAddress.Text, TextBoxCity.Text, TextBoxState.Text, TextBoxZipCode.Text, DropDownListCountry.SelectedValue.ToString(), TextBoxSupPhno.Text, TextBoxEmail.Text, TextBoxGSTNo.Text);
                 Globals.MessageBoxShow(this, "Saved Successfully");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
 protected void ButtonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         ErpDataContext db    = new ErpDataContext();
         string         strId = HiddenField1.Value.ToString();
         Int32          Id;
         if (!String.IsNullOrEmpty(strId))
         {
             var IdResult = db.GetAcountId(strId).ToList();
             Id = System.Convert.ToInt32(IdResult[0].Id);
             db.DeleteAccountDetail(Id);
             Globals.MessageBoxShow(this, "Deleted Successfully");
             Clear();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }