public static ResultBOL <int> InsertOrUpdate(OtherTypeBOL BOL) { string stored = "sp_OtherType_Insert_Update"; var result = DataAccessHelpers.ExecuteStored(stored, BOL.GetParameters()); return(result); }
private void StartAddMenuOther() { string tag = __tag + "[StartAddMenuOther]"; LogHelpers.WriteStatus(tag, "Start..."); try { HtmlGenericControl li = new HtmlGenericControl("li"); li.InnerHtml = string.Format("<a href='{0}'>{1}</a>", "Other.aspx", "Other"); var result = OtherTypeDAL.GetAll(); if (result.Code >= 0 && result.Data.Tables.Count > 0) { HtmlGenericControl ul = new HtmlGenericControl("ul"); foreach (DataRow row in result.Data.Tables[0].Rows) { OtherTypeBOL otherType = new OtherTypeBOL(row); if (otherType == null) { continue; } HtmlGenericControl subLi = new HtmlGenericControl("li"); subLi.InnerHtml = string.Format("<a href='{0}?CatId={1}'>{2}</a>", "OtherDetail.aspx", otherType.Id, otherType.Name_VN); ul.Controls.Add(subLi); } if (ul.Controls.Count > 0) { li.Controls.Add(ul); } } this.ulMenuAdmin.Controls.Add(li); } catch (Exception ex) { LogHelpers.WriteException(tag, ex.ToString()); } finally { LogHelpers.WriteStatus(tag, "End."); } }
private void StartLoadOtherInfo(int id) { string tag = __tag + "[StartLoadOtherInfo]"; LogHelpers.WriteStatus(tag, "Start..."); lbError.Visible = false; try { var result = OtherTypeDAL.Get(id); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = true; return; } OtherTypeBOL otherType = new OtherTypeBOL(result.Data.Tables[0].Rows[0]); hfId.Value = otherType.Id.ToString(); tbxNameVN.Text = otherType.Name_VN; tbxNameEN.Text = otherType.Name_EN; tbxDesVN.Text = otherType.Description_VN; tbxDesEN.Text = otherType.Description_EN; if (otherType.Name_VN == "Banner") { tbxNameEN.Enabled = false; tbxNameVN.Enabled = false; } else { tbxNameVN.Enabled = true; tbxNameEN.Enabled = true; } //--- btnSubmit.Text = "Update"; btnCancel.Visible = true; } catch (Exception ex) { LogHelpers.WriteException(tag, ex.ToString()); lbError.InnerText = ex.Message; lbError.Visible = true; } finally { LogHelpers.WriteStatus(tag, "End."); } }
private void InsertOrUpdateBannerProcess() { string tag = __tag + "[InsertOrUpdateBannerProcess]"; LogHelpers.WriteStatus(tag, "Start..."); try { if (tbxNameVN.Enabled) { UpdateOtherProcess(); return; } OtherTypeBOL other = new OtherTypeBOL() { Id = string.IsNullOrEmpty(hfId.Value) ? 0 : int.Parse(hfId.Value), Name_VN = tbxNameVN.Text, Name_EN = tbxNameEN.Text, Description_VN = tbxDesVN.Text, Description_EN = tbxDesEN.Text, InsertDate = DateTime.Now, UpdatedDate = DateTime.Now }; var result = OtherTypeDAL.InsertOrUpdate(other); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = true; return; } StartClearData(); Response.Redirect(Request.RawUrl, false); } catch (Exception ex) { LogHelpers.WriteException(tag, ex.ToString()); lbError.InnerText = ex.Message; lbError.Visible = true; } }
private void StartLoadOtherInfo(int id) { string tag = __tag + "[StartLoadOtherInfo]"; LogHelpers.WriteStatus(tag, "Start..."); formSubMenu.Visible = false; lbError.Visible = false; try { var result = OtherTypeDAL.Get(id); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = true; return; } OtherTypeBOL otherType = new OtherTypeBOL(result.Data.Tables[0].Rows[0]); hfId.Value = otherType.Id.ToString(); tbxNameVN.Text = otherType.Name_VN; tbxNameEN.Text = otherType.Name_EN; tbxDesVN.Text = otherType.Description_VN; tbxDesEN.Text = otherType.Description_EN; btnAddSubMenu.Attributes.Add("data-id", otherType.Id.ToString()); if (!otherType.Name_VN.Contains("Banner")) { formSubMenu.Visible = true; } tbxNameEN.Enabled = false; tbxNameVN.Enabled = false; //--- //btnSubmit.Text = "Update"; //btnCancel.Visible = true; } catch (Exception ex) { LogHelpers.WriteException(tag, ex.ToString()); lbError.InnerText = ex.Message; lbError.Visible = true; } }