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; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ErpDataContext db = new ErpDataContext(); GridViewRegistrationDetails.DataSource = db.GetCustomerDetail(); GridViewRegistrationDetails.DataBind(); } }
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; } }
protected void ButtonAddCategory_Click(object sender, EventArgs e) { try { if (IsValidData()) { ErpDataContext db = new ErpDataContext(); if (ButtonAddCategory.Text == "Add") { db.AddCategory(LabelHeading.Text, TextBoxName.Text, TextBoxDesc.Text); Globals.MessageBoxShow(this, "Saved Successfully"); Clear(); } else if (ButtonAddCategory.Text == "Edit") { Regex re = new Regex(@"([a-zA-Z]+)(\d+)"); Match result = re.Match(TextBoxCode.Text); string strCode = result.Groups[2].Value; db.UpdateCategory(TextBoxName.Text, TextBoxDesc.Text, System.Convert.ToInt32(strCode)); Globals.MessageBoxShow(this, "Updated Successfully"); Clear(); } else if (ButtonAddCategory.Text == "Delete") { Regex re = new Regex(@"([a-zA-Z]+)(\d+)"); Match result = re.Match(TextBoxCode.Text); string strCode = result.Groups[2].Value; db.DeleteCategory(LabelHeading.Text, System.Convert.ToInt32(strCode)); Globals.MessageBoxShow(this, "Deleted Successfully"); Clear(); } } } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { ErpDataContext db = new ErpDataContext(); DataTable dtCountry = new DataTable(); var result = db.SpCountry(); dtCountry = Globals.ObtainDataTableFromIEnumerable(result); DropDownListCountry.DataSource = dtCountry; DropDownListCountry.DataValueField = "CountryName"; DropDownListCountry.DataTextField = "CountryName"; DropDownListCountry.DataBind(); DropDownListCountry.Items.Insert(0, new ListItem("Select Country", "")); } } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { string strCat = Convert.ToString(Request.QueryString["Value"]); LabelHeading.Text = strCat + " Details"; if (strCat == BRAND) { ErpDataContext db = new ErpDataContext(); GridViewCategory.DataSource = db.GetBrand(); GridViewCategory.DataBind(); } if (strCat == COLOR) { ErpDataContext db = new ErpDataContext(); GridViewCategory.DataSource = db.GetColor(); GridViewCategory.DataBind(); } if (strCat == SIZE) { ErpDataContext db = new ErpDataContext(); GridViewCategory.DataSource = db.GetSize(); GridViewCategory.DataBind(); } }