protected void RpBanner_ItemCommand(object source, RepeaterCommandEventArgs e) { string strCommand = e.CommandName; int nID = ConvertData.ConvertToInt(e.CommandArgument); Banners objBanner = new Banners(); switch (strCommand) { case "Delete": objBanner.LoadById(nID); Support.DeleteFile("banner", objBanner.Data.Images); int nDelete = objBanner.DeleteById(nID); BindDataToGrid(1); break; case "Edit": string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_BANNER_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + nID; Response.Redirect(sEdit); break; case "Active": int nActive = objBanner.UpdateStatus(nID, EnumeType.INACTIVE); BindDataToGrid(1); break; case "Inactive": int nInactive = objBanner.UpdateStatus(nID, EnumeType.ACTIVE); BindDataToGrid(1); break; } }
private void BinddatatoSlideRepeater() { var objBanner = new Banners(); DataTable dtbBanner = objBanner.GetSlideImage(); rptSlide.DataSource = dtbBanner; rptSlide.DataBind(); }
private void BinddatatoSlideRepeater() { int nPageCount = 0; DataTable dtbBanner = new DataTable(); Banners objBanner = new Banners(); dtbBanner = objBanner.Search(1, 1, 5, ref nPageCount); rptSlide.DataSource = dtbBanner; rptSlide.DataBind(); }
protected void btnSave_Click1(object sender, EventArgs e) { int nActionResult = 0; int nPriority = ConvertData.ConvertToInt(txtPriority.Text); Banners objBannerObj = new Banners(); objBannerObj.Data = SetData( nPriority); string sAction = GetQuerryString(Constants.ACTION); if (sAction == Constants.ACTION_EDIT) { //Is Edit int nItemID = ConvertData.ConvertToInt(Request.QueryString[Constants.ACTION_ID]); nActionResult = objBannerObj.Update(nItemID); if (nActionResult > 0) { // Show updated image if (objBannerObj.Data.Images.ToString() != "") { imgImage.ImageUrl = Constants.ROOT + Constants.IMAGE_BANNER_DEFAULT_UPLOAD + objBannerObj.Data.Images.ToString(); lbimg.Text = ConvertData.ConvertToString(objBannerObj.Data.Images); urlImg.NavigateUrl = Constants.ROOT + Constants.IMAGE_BANNER_DEFAULT_UPLOAD + objBannerObj.Data.Images; MessageBoxss.Show(MessagesAlert.UPDATE_SUCCESSFUL); } } else MessageBoxss.Show(MessagesAlert.UPDATE_UNSUCCESSFUL); } else { nActionResult = objBannerObj.Insert(); if (nActionResult > 0) { string sURL = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_BANNER + "&" + Constants.MESS_ID + "=" + Constants.MESSAGE_INSERT; Response.Redirect(sURL); } } }
private eBanners BannerEntity() { eBanners entityBanner = new eBanners(); int nItemID = ConvertData.ConvertToInt(Request.QueryString[Constants.ACTION_ID]); string sQueery = ConvertData.ConvertToString(Request.QueryString[Constants.ACTION]); if (nItemID > 0 && sQueery == Constants.ACTION_EDIT) { Banners objBanner = new Banners(); objBanner.LoadById(nItemID); entityBanner = objBanner.Data; } return entityBanner; }
private eBanners SetData( int nPriority) { string sQueery = ConvertData.ConvertToString(Request.QueryString[Constants.ACTION]); eBanners eBannerEntity = this.BannerEntity(); Banners objBanner = new Banners(); if (chkDisplayOrder.Checked) objBanner.Data.Priority = ConvertData.ConvertToInt(txtPriority.Text); else objBanner.Data.Priority = 0; objBanner.Data.Link = ConvertData.ConvertToString(txtLink.Text.Trim()); if (iptImage.Value != "") { Support.DeleteFile("banner", eBannerEntity.Images); objBanner.Data.Images = Support.UploadFile(iptImage, "banner"); } if (iptImage.Value == "") { if (eBannerEntity.Images.Length > 0) { objBanner.Data.Images = eBannerEntity.Images; } else { objBanner.Data.Images = ""; } } if (chkActive.Checked) objBanner.Data.Status = Constants.STATUS_ACTIVE; else objBanner.Data.Status = Constants.STATUS_INACTIVE; //objBanner.Data.BannerType = ConvertData.ConvertToInt(ddlType.SelectedValue); string sTitle = ConvertData.ConvertToString(ConvertData.RemoveHTMLTag(txtTitle.Text.Trim())); string sInitContent = ConvertData.ConvertToString(ConvertData.RemoveHTMLTag(txtInitContent.Text.Trim())); objBanner.Data.Title = sTitle; objBanner.Data.InitContent = sInitContent; return objBanner.Data; }
private void GetData( int ItemID) { rfvImage.Enabled = false; // Get data to view on UI Controls int nDisplayOrder = 0; int nStatus = 0; //chkActive.Enabled = true; Banners objBanner = new Banners(); objBanner.LoadById(ItemID); nDisplayOrder = ConvertData.ConvertToInt(objBanner.Data.Priority); if (nDisplayOrder > 0) chkDisplayOrder.Checked = true; else chkDisplayOrder.Checked = false; nStatus = ConvertData.ConvertToInt(objBanner.Data.Status); if (nStatus > 0) chkActive.Checked = true; else chkActive.Checked = false; txtTitle.Text = objBanner.Data.Title; txtInitContent.Text = objBanner.Data.InitContent; txtLink.Text = ConvertData.ConvertToString(objBanner.Data.Link); lbimg.Text = ConvertData.ConvertToString(objBanner.Data.Images); urlImg.NavigateUrl = Constants.ROOT + Constants.IMAGE_BANNER_DEFAULT_UPLOAD + objBanner.Data.Images; if (objBanner.Data.Images != "") { imgImage.ImageUrl = Constants.ROOT + Constants.IMAGE_BANNER_DEFAULT_UPLOAD + objBanner.Data.Images; lbimg.Text = ConvertData.ConvertToString(objBanner.Data.Images); urlImg.NavigateUrl = Constants.ROOT + Constants.IMAGE_BANNER_DEFAULT_UPLOAD + objBanner.Data.Images; } else { imgImage.ImageUrl = Constants.IMAGE_NO_IMAGE; } }
private void BindDataPriorityText() { DataTable dtbBanner = new DataTable(); Banners objBanner = new Banners(); dtbBanner = objBanner.GetAll(); int nCount = dtbBanner.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; eBanners eBannerEntity = this.BannerEntity(); string sPriority = ConvertData.ConvertToString(eBannerEntity.Priority); txtPriority.Text = sPriority; } else { nRealValue = nCount + 1; txtPriority.Text = ConvertData.ConvertToString(nRealValue); } }
private void BindDataToGrid(int CurrentPageIndex) { DataTable dtbBanner = new DataTable(); Banners objBanner = new Banners(); dtbBanner = objBanner.GetAll(); RpBanner.DataSource = dtbBanner; RpBanner.DataBind(); }