private void BindDataToCategoryDropdown() { DataTable dtbCategory = new DataTable(); FAQCategory objFAQCategory = new FAQCategory(); dtbCategory = objFAQCategory.Search(); ddlCategory.DataSource = dtbCategory; ddlCategory.DataValueField = "FAQCategoryID"; ddlCategory.DataTextField = "Description"; ddlCategory.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { FAQCategory objColor = new FAQCategory(); eFAQCategory eProductColor = this.FAQCategoryEntity(); objColor.Data.Description = txtDescript.Text.Trim(); int nResult = 0; string sLink = ""; string sAction = Request.QueryString[Constants.ACTION]; switch (sAction) { case Constants.ACTION_ADD: objColor.Data.Description = txtDescript.Text.Trim(); nResult = objColor.Insert(); if (nResult > 0) { sLink = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_FAQCAT + "&" + Constants.MESS_ID + "=1"; Response.Redirect(sLink); } else MessageBoxss.Show(MessagesAlert.INSERT_UNSUCCESSFUL); break; case Constants.ACTION_EDIT: int nID = ConvertData.ConvertToInt(Request.QueryString[Constants.ACTION_ID]); objColor.LoadById(nID); objColor.Data.Description = txtDescript.Text.Trim(); nResult = objColor.Update(nID); if (nResult > 0) { sLink = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_FAQCAT + "&" + Constants.MESS_ID + "=2"; Response.Redirect(sLink); } else MessageBoxss.Show(MessagesAlert.UPDATE_UNSUCCESSFUL); break; } }
protected void RptFAQCat_ItemCommand(object source, RepeaterCommandEventArgs e) { string strCommand = e.CommandName; int nID = ConvertData.ConvertToInt(e.CommandArgument); FAQCategory obj = new FAQCategory(); switch (strCommand) { case "Delete": int nDelete = obj.DeleteById(nID); BindDataToRepeater(); break; case "Edit": string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_FAQCAT_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + nID; Response.Redirect(sEdit); break; } }
private void BindDataToRepeater() { DataTable dtbFaQCat = new DataTable(); FAQCategory objNews = new FAQCategory(); dtbFaQCat = objNews.Search(); RptFAQCat.DataSource = dtbFaQCat; RptFAQCat.DataBind(); }
private void BindDataWhenEdit() { string sAction = ConvertData.ConvertToString(Request.QueryString[Constants.ACTION]); try { if (sAction == Constants.ACTION_EDIT) { int nID = ConvertData.ConvertToInt(Request.QueryString[Constants.ACTION_ID]); if (nID > 0) { FAQCategory obj = new FAQCategory(); obj.LoadById(nID); txtDescript.Text = ConvertData.ConvertToString(obj.Data.Description); } } } catch { string sLink = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_FAQCAT; Response.Redirect(sLink); } }
private eFAQCategory FAQCategoryEntity() { eFAQCategory entityFAQCategory = new eFAQCategory(); int nItemID = ConvertData.ConvertToInt(Request.QueryString[Constants.ACTION_ID]); string sQueery = ConvertData.ConvertToString(Request.QueryString[Constants.ACTION]); if (nItemID > 0 && sQueery == Constants.ACTION_EDIT) { FAQCategory obj = new FAQCategory(); obj.LoadById(nItemID); entityFAQCategory = obj.Data; } return entityFAQCategory; }
private string GetCategoryNameByID(int nCatID, int LangID) { string sCategoryName = ""; FAQCategory objFAQCategory = new FAQCategory(); objFAQCategory.LoadById(nCatID); sCategoryName = ConvertData.ConvertToString(objFAQCategory.Data.Description); return sCategoryName; }
private void BindDataToCategoryDropdown() { FAQCategory objFAQCategory = new FAQCategory(); DataTable dtbFAQCategory = new DataTable(); dtbFAQCategory = objFAQCategory.Search(); ddlFAQCat.DataSource = dtbFAQCategory; ddlFAQCat.DataValueField = "FAQCategoryID"; ddlFAQCat.DataTextField = "Description"; ddlFAQCat.DataBind(); Utl1.SetNonSelectToControl(ddlFAQCat, MultipleLanguage.DDL_SELECTVALUE, "0"); }