protected void btnDelete_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(hfId.Value)) { try { PatternFacade facade = new PatternFacade(); int id = Convert.ToInt32(hfId.Value); facade.Delete(id); gvPatterns.DataBind(); lblErrorMessage.Text = Helper.DeleteRecordMessage(true); } catch (Exception exception) { lblErrorMessage.Text = Helper.DeleteRecordMessage(false); } } }
protected void btnSave_Click(object sender, EventArgs e) { PatternFacade facade = new PatternFacade(); int? nullValue = null; int? id = null; try { id = (!String.IsNullOrEmpty(hfId.Value)) ? Convert.ToInt32(hfId.Value) : id; facade.Save(id, (!String.IsNullOrEmpty(ddlSupplier.ddlId) ? Convert.ToInt32(ddlSupplier.ddlId) : nullValue), txtPatternCode.Text, txtPatternMaker.Text, Convert.ToDecimal(txtPrice.Text) , Convert.ToDecimal(txtOuterDiameter.Text), Convert.ToDecimal(txtInnerDiameter.Text), Convert.ToDecimal(txtHeight.Text), Convert.ToDecimal(txtWidth.Text), Convert.ToDecimal(txtLength.Text), txtModificationRemarks.Text, DateTime.Now, DateTime.Now, user, user, ""); lblErrorMessage.Text = Helper.SaveRecordMessage(true); } catch (Exception ex) { lblErrorMessage.Text = Helper.SaveRecordMessage(false); } gvPatterns.DataBind(); Helper.EnableControls(false, action); }