protected void RpStaticPage_ItemCommand(object source, RepeaterCommandEventArgs e) { string strCommand = e.CommandName; int IntpageID = ConvertData.ConvertToInt(e.CommandArgument); StaticPages objPage = new StaticPages(); int nStatus = 0; switch (strCommand) { case "Edit": string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_STATICPAGE_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + IntpageID; Response.Redirect(sEdit); break; case "Delete": objPage.LoadById(IntpageID); string sDelImage = Support.DeleteFile("staticpage", ConvertData.ConvertToString(objPage.Data.Images)); nStatus = objPage.DeleteById(IntpageID); BindData(1); break; case "Active": nStatus = objPage.UpdateStatus(IntpageID, Constants.STATUS_INACTIVE); BindData(1); break; case "Inactive": nStatus = objPage.UpdateStatus(IntpageID, Constants.STATUS_ACTIVE); BindData(1); break; } }
private void BindData() { int nID = 1;// ConvertData.ConvertToInt(Request.QueryString["pid"]); try { StaticPages obj = new StaticPages(); obj.LoadById(nID); string sUrl = Constants.ROOT + "StaticPageDetails.aspx" + "?pid=" + nID; string sImage = obj.Data.Images; lnkIntroduct.Text = obj.Data.PageName; lnkIntroduct.NavigateUrl = sUrl; lblInit.Text = obj.Data.InitContent; lnkimg.NavigateUrl = sUrl; if (sImage.Length > 0) { img.ImageUrl = Constants.ROOT + Constants.IMAGE_STATICPAGE_DEFAULT_UPLOAD + sImage; } else { img.ImageUrl = Constants.ROOT + Constants.IMAGE_NO_IMAGE_FRONTEND; } } catch { //Response.Redirect("/index.html"); Response.Redirect("~/Default.aspx"); } }
protected void btnSave_Click1(object sender, EventArgs e) { string sContent = ConvertData.ConvertToString(txtcontent.Text); if (sContent != "") { int nActionResult = 0; StaticPages objNewsObj = new StaticPages(); objNewsObj.Data = SetData(); string sAction = GetQuerryString(Constants.ACTION); if (sAction == Constants.ACTION_EDIT) { //Is Edit int nItemID = ConvertData.ConvertToInt(Request.QueryString[Constants.ACTION_ID]); nActionResult = objNewsObj.Update(nItemID); if (nActionResult > 0) { MessageBoxss.Show(MessagesAlert.UPDATE_SUCCESSFUL); // Show updated image if (objNewsObj.Data.Images.ToString() != "") { imgImage.ImageUrl = Constants.ROOT + Constants.IMAGE_STATICPAGE_DEFAULT_UPLOAD + objNewsObj.Data.Images.ToString(); lbimg.Text = ConvertData.ConvertToString(objNewsObj.Data.Images); urlImg.NavigateUrl = Constants.ROOT + Constants.IMAGE_STATICPAGE_DEFAULT_UPLOAD + objNewsObj.Data.Images; } } else MessageBoxss.Show(MessagesAlert.UPDATE_UNSUCCESSFUL); } else { // Is Insert New nActionResult = objNewsObj.Insert(); if (nActionResult > 0) { string sURL = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_STATICPAGE + "&" + Constants.MESS_ID + "=" + Constants.MESSAGE_INSERT; Response.Redirect(sURL); } } } else { txtcontent.Focus(); MessageBoxss.Show(MessagesValidate.NEWS_CONTENT_EMPTY); } }
private void BindData() { int nID = 11;//gio hang try { StaticPages obj = new StaticPages(); obj.LoadById(nID); ltrStaticPage.Text = obj.Data.PageContent; } catch { Response.Redirect("/index.html"); //Response.Redirect("~/Default.aspx"); } }
private void BindData() { int nID = ConvertData.ConvertToInt(Request.QueryString["pid"]); try { StaticPages obj = new StaticPages(); obj.LoadById(nID); ltrContent.Text = obj.Data.PageContent; //lblTitle.Text = obj.Data.PageName; } catch { Response.Redirect("/Default.aspx"); //Response.Redirect("~/Default.aspx"); } }
private void BindData(int CurrentPageIndex) { int nStatus = -1; string sKeyword =""; int nPageSize = 1000; int nPageCount = Constants.PAGECOUNT; DataTable dtbPage = new DataTable(); StaticPages objPage = new StaticPages(); dtbPage = objPage.Search(sKeyword, 0,0, nStatus, CurrentPageIndex, nPageSize, ref nPageCount); FlowCategory flow = new FlowCategory(dtbPage, VERTICAL_COLUMN_NAME, HOLIZOTAL_COLUMN_NAME); if (nStatus == -1 && sKeyword == string.Empty) // search all { DataTable objTable = new DataTable(); StaticPages obj = new StaticPages(); objTable = obj.Search("", 0,1, -1, 1, 10000, ref nPageCount); FlowCategory objflow = new FlowCategory(objTable, VERTICAL_COLUMN_NAME, HOLIZOTAL_COLUMN_NAME); objflow.IDColumnName = "StaticPageID"; objflow.ParentIDColumName = "[Parent]"; flow.SortColumnName = "MenuName"; objflow.SortColumnName = "Priority"; objflow.ParentSortDirection = "ASC"; if (objflow.Execute(0)) { int iCurrIndex = 0; if (CurrentPageIndex > 0) iCurrIndex = CurrentPageIndex - 1; mCateData = objflow.DestinationData(); FlowPager pager = new FlowPager(mCateData, nPageSize, "[Parent]"); DataView vwPage = pager.GeneralPageByIndex(iCurrIndex, VERTICAL_COLUMN_NAME); hidSearchStatus.Value = "1"; RpStaticPage.DataSource = vwPage; nPageCount = mCateData.Rows.Count; nPageSize = pager.TotalRecord; } mCateData = objflow.DestinationData(); RpStaticPage.DataBind(); //lblTotalRecord.Text = "Có" + " " + +nPageCount + " " + "Bản ghi được tìm thấy"; } else // Search Active or Inactive { hidSearchStatus.Value = "0"; RpStaticPage.DataBind(); //lblTotalRecord.Text = ConvertData.ConvertToString(nPageCount); } }
private eStaticPages SetData() { string sQueery = ConvertData.ConvertToString(Request.QueryString[Constants.ACTION]); eStaticPages eNewsEntity = this.NewsEntity(); StaticPages objNews = new StaticPages(); objNews.Data.Parent = ConvertData.ConvertToInt(ddlCategory.SelectedValue); objNews.Data.GroupID = ConvertData.ConvertToInt(ddlGroup.SelectedValue); if (chkActive.Checked) objNews.Data.Status = Constants.STATUS_ACTIVE; else objNews.Data.Status = Constants.STATUS_INACTIVE; if (chkDisplayOrder.Checked) { objNews.Data.Priority = ConvertData.ConvertToInt(txtPriority.Text); } else { objNews.Data.Priority = 0; } objNews.Data.Priority = ConvertData.ConvertToInt(txtPriority.Text); objNews.Data.DateCreated = ConvertData.ConvertDatetimeToInt(DateTime.Today); if (iptImage.Value != "") { Support.DeleteFile("staticpage", eNewsEntity.Images); objNews.Data.Images = Support.UploadFile(iptImage, "staticpage"); } else { if (eNewsEntity.Images != "") objNews.Data.Images = ConvertData.ConvertToString(eNewsEntity.Images); else objNews.Data.Images = ""; objNews.Data.Images = ConvertData.ConvertToString(eNewsEntity.Images); } string sCode = ConvertData.ConvertToString(eNewsEntity.PageCode); if (sCode.Length > 0) { objNews.Data.PageCode = sCode; } else { objNews.Data.PageCode = ConvertData.ConvertToString(txtMenuName.Text.Replace(" ", "-").ToLower()); } string sTitle = ConvertData.ConvertToString(ConvertData.RemoveHTMLTag(txtTitle.Text.Trim())); string sMenuName = ConvertData.ConvertToString(ConvertData.RemoveHTMLTag(txtMenuName .Text.Trim())); string sInitContent = ConvertData.ConvertToString(txtInitContent.Text.Trim()); string sMainContent = ConvertData.ConvertToString(txtcontent.Text); objNews.Data.MenuName = sMenuName; objNews.Data.PageName = sTitle; objNews.Data.PageContent = sMainContent; objNews.Data.InitContent = sInitContent; return objNews.Data; }
private eStaticPages NewsEntity() { eStaticPages entityNews = new eStaticPages(); int nItemID = ConvertData.ConvertToInt(Request.QueryString[Constants.ACTION_ID]); string sQueery = ConvertData.ConvertToString(Request.QueryString[Constants.ACTION]); if (nItemID > 0 && sQueery == Constants.ACTION_EDIT) { StaticPages objNews = new StaticPages(); objNews.LoadById(nItemID); entityNews = objNews.Data; } return entityNews; }
private void GetData(int ItemID) { // Get data to view on UI Controls int nStatus = 0; int nDisplayOrder = 0; StaticPages objStaticPage = new StaticPages(); objStaticPage.LoadById(ItemID); nStatus = ConvertData.ConvertToInt(objStaticPage.Data.Status); if (nStatus > 0) chkActive.Checked = true; else chkActive.Checked = false; nDisplayOrder = ConvertData.ConvertToInt(objStaticPage.Data.Priority); if (nDisplayOrder > 0) chkDisplayOrder.Checked = true; else chkDisplayOrder.Checked = false; nStatus = ConvertData.ConvertToInt(objStaticPage.Data.Status); int nPriority = ConvertData.ConvertToInt(objStaticPage.Data.Priority); txtPriority.Text = ConvertData.ConvertToString(objStaticPage.Data.Priority); ddlGroup.SelectedValue = ConvertData.ConvertToString(objStaticPage.Data.GroupID); txtTitle.Text = objStaticPage.Data.PageName; txtMenuName.Text = objStaticPage.Data.MenuName; txtcontent.Text = (ConvertData.ConvertToString(objStaticPage.Data.PageContent)); txtInitContent.Text = ConvertData.ConvertToString(objStaticPage.Data.InitContent); if (objStaticPage.Data.Images != "") imgImage.ImageUrl = Constants.ROOT + Constants.IMAGE_STATICPAGE_DEFAULT_UPLOAD + objStaticPage.Data.Images; else imgImage.ImageUrl = Constants.IMAGE_NO_IMAGE; lbimg.Text = ConvertData.ConvertToString(objStaticPage.Data.Images); urlImg.NavigateUrl = Constants.ROOT + Constants.IMAGE_STATICPAGE_DEFAULT_UPLOAD + objStaticPage.Data.Images; int nParent = ConvertData.ConvertToInt(objStaticPage.Data.Parent); if (nParent >0) { ddlCategory.SelectedValue = ConvertData.ConvertToString(nParent); } }
private void BindDataToDropCategory() { int nPageCount = 0; ddlCategory.Items.Clear(); DataTable objTable = new DataTable(); StaticPages objStaticPages = new StaticPages(); objTable = objStaticPages.Search("", 0,0, -1, 1, 10000, ref nPageCount); int nCount = objTable.Rows.Count; FlowCategory flow = new FlowCategory(objTable, VERTICAL_COLUMN_NAME, HOLIZOTAL_COLUMN_NAME); flow.IDColumnName = "StaticPageID"; flow.ParentIDColumName = "[Parent]"; flow.SortColumnName = "MenuName"; flow.SortColumnName = "Priority"; flow.ParentSortDirection = "ASC"; if (flow.Execute(0)) { mCateData = flow.DestinationData(); } if (mCateData != null) { foreach (DataRow dr in mCateData.Rows) { if (dr != null) { string sText = Convert.ToString(dr["MenuName"]); Int16 iHolz = Convert.ToInt16(dr[HOLIZOTAL_COLUMN_NAME]); textCreateMarginLeft(ref sText, iHolz); ListItem item = new ListItem(sText, Convert.ToString(dr["StaticPageID"])); ddlCategory.Items.Add(item); } } Utl1.SetNonSelectToControl(ddlCategory, MultipleLanguage.DDL_SELECTVALUE, "0"); } else { ddlCategory.DataSource = mCateData; ddlCategory.DataTextField = "MenuName"; ddlCategory.DataValueField = "StaticPageID"; ddlCategory.DataBind(); Utl1.SetNonSelectToControl(ddlCategory, "Tất cả", "0"); } }
private void BindDataPriorityText() { DataTable dtbNews = new DataTable(); StaticPages objNews = new StaticPages(); dtbNews = objNews.SearchAll(); int nCount = dtbNews.Rows.Count; string sAction = GetQuerryString(Constants.ACTION);//Lay Thong tin Edit, Insert int nRealValue = 0; if (sAction == Constants.ACTION_EDIT)//Kiem tra dieu kien { nRealValue = nCount; eStaticPages eProductsEntity = this.NewsEntity(); string sPriority = ConvertData.ConvertToString(eProductsEntity.Priority); txtPriority.Text = sPriority; } else { nRealValue = nCount + 1; txtPriority.Text = ConvertData.ConvertToString(nRealValue); } }
private void LoadData() { int nTotal = ConvertData.ConvertToInt(Request.QueryString["total"]); lblTotal.Text = ConvertData.ConvertToString(Support.FormatCurrency(nTotal)) + " " + "VNĐ"; Company objCompany = new Company(); DataTable dtbCompany = new DataTable(); dtbCompany = objCompany.Search(); int nCompanyCount = dtbCompany.Rows.Count; int nCompanyLastestID = ConvertData.ConvertToInt(dtbCompany.Rows[nCompanyCount - 1]["CompanyID"]); objCompany.LoadById(nCompanyLastestID); lblCompanyName.Text = objCompany.Data.CompanyName; string nID = Request.QueryString["id"]; int nIndex = nID.IndexOf("-"); int nCount = nID.Split('-').Length - 1; ArrayList alProducts = new ArrayList(nID.Split('-')); ArrayList alsProducts = new ArrayList(); for (int i = 0; i < nCount; i++) { alsProducts.Add(new PositionData(ConvertData.ConvertToInt(alProducts[i]))); } rptProducts.DataSource = alsProducts; rptProducts.DataBind(); StaticPages objStaticPage = new StaticPages(); objStaticPage.LoadById(14); ltrTaikhoan.Text = objStaticPage.Data.PageContent; }