public void grdListCategory_EditCommand(object source, DataGridCommandEventArgs e) { HPCBusinessLogic.DAL.T_Customer_AdsDAL obj_Cate = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); if (e.CommandArgument.ToString().ToLower() == "edit") { int catID = Convert.ToInt32(this.grdListCate.DataKeys[e.Item.ItemIndex].ToString()); Session["AsdLogolist_LangID"] = cbo_lanquage.SelectedValue; Response.Redirect("~/Quangcao/AdsLogoEdit.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + catID); } if (e.CommandArgument.ToString().ToLower() == "viewads") { T_Customer_Ads _obj = new T_Customer_Ads(); T_Customer_AdsDAL _DAL = new T_Customer_AdsDAL(); DataTable _dtAds = null; try { EID = Convert.ToInt32(this.grdListCate.DataKeys[e.Item.ItemIndex].ToString()); _obj = _DAL.GetOneFromT_Customer_AdsByID(EID); if (_obj.Possittion.ToString() != "") { _dtAds = _DAL.BindGridT_Customer_Ads(_obj.Possittion.ToString().Trim()).Tables[0]; rptSlideShows.DataSource = _dtAds.DefaultView; rptSlideShows.DataBind(); } ModalPopupExtender2.Show(); } catch (Exception ex) { } } }
public void LoadData() { //string where = " 1=1 AND Lang_ID IN (SELECT T_UserLanguages.Languages_ID FROM T_UserLanguages WHERE T_UserLanguages.[User_ID] = " + _user.UserID + ")"; string where = " 1=1 "; if (cbo_lanquage.SelectedIndex > 0) { where += " AND Lang_ID=" + cbo_lanquage.SelectedValue.ToString(); } if (cbo_Khachhang.SelectedIndex > 0) { where += " AND Cust_ID=" + cbo_Khachhang.SelectedValue.ToString(); } where += " Order by Order_Number ASC"; pages.PageSize = Global.MembersPerPage; HPCBusinessLogic.DAL.T_Customer_AdsDAL _cateDAL = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); DataSet _ds; _ds = _cateDAL.Bind_T_Customer_AdsDynamic(pages.PageIndex, pages.PageSize, where); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _cateDAL.Bind_T_Customer_AdsDynamic(pages.PageIndex - 1, pages.PageSize, where); } // DataView _dv = _cateDAL.BindGridCagegorys(_ds.Tables[0]); grdListCate.DataSource = _ds; grdListCate.DataBind(); _ds.Clear(); pages.TotalRecords = curentPages.TotalRecords = TotalRecords; curentPages.TotalPages = pages.CalculateTotalPages(); curentPages.PageIndex = pages.PageIndex; Session["PageIndex"] = pages.PageIndex; }
private void PopulateItem(int _id) { HPCInfo.T_Customer_Ads _cateObj = new HPCInfo.T_Customer_Ads(); HPCBusinessLogic.DAL.T_Customer_AdsDAL _cateDAL = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); _cateObj = _cateDAL.load_T_Customer_Ads(_id); if (_cateObj != null) { Txt_DiachiQC.Text = _cateObj.URL.ToString(); if (_cateObj.Start_Date.ToString().Length > 0) { txt_ngaybatdau.Text = _cateObj.Start_Date.ToString("dd/MM/yyyy"); } else { txt_ngaybatdau.Text = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); } if (_cateObj.End_Date.ToString().Length > 0) { txt_ngayketthuc.Text = _cateObj.End_Date.ToString("dd/MM/yyyy"); } else { txt_ngayketthuc.Text = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); } txtOrder.Text = _cateObj.Order_Number.ToString(); this.txtWidth.Text = _cateObj.Width.ToString().Trim(); this.txtHeight.Text = _cateObj.Height.ToString().Trim(); txtImageVideo.Text = _cateObj.Ads_ImgVideo.ToString(); txtThumbnail.Text = _cateObj.Ads_Images.ToString(); //if (_cateObj.Ads_ImgVideo.Length > 0) // this.ImagesVd.Src = _cateObj.Ads_ImgVideo; //if (_cateObj.Ads_Images.Length > 0) // this.ImgTemp.Src =_cateObj.Ads_Images; cbo_Khachhang.SelectedValue = _cateObj.Cust_ID.ToString(); cbo_lanquage.SelectedValue = _cateObj.Lang_ID.ToString(); cbo_Vitri_hienthi.SelectedValue = _cateObj.Possittion.ToString(); cbo_Display.SelectedValue = _cateObj.Target.ToString(); txtMota.Text = _cateObj.DisplayType.ToString(); if (_cateObj.Status == 1) { chkDisplay.Checked = true; } else { chkDisplay.Checked = false; } if (_cateObj.Cat_ID.ToString().ToLower() == "all") { this.cbo_Category.SelectedValue = _cateObj.Cat_ID.ToString(); //this.cbo_Category.UpdateAfterCallBack = true; System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "javascript", "javascript: SetDisplay('none');", true); } else { this.cbo_Category.SelectedValue = "CM"; //this.cbo_Category.UpdateAfterCallBack = true; System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "javascript", "javascript: SetDisplay('block');", true); } } }
private HPCInfo.T_Customer_Ads GetObject() { HPCInfo.T_Customer_Ads _objCate = new HPCInfo.T_Customer_Ads(); HPCBusinessLogic.DAL.T_Customer_AdsDAL _CateDAL = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); if (Page.Request["id"] != null) { _objCate.ID = int.Parse(Page.Request["id"].ToString()); _objCate = _CateDAL.GetOneFromT_Customer_AdsByID(int.Parse(Page.Request["id"].ToString())); } else { _objCate.ID = 0; _objCate.DateCreated = DateTime.Now; _objCate.UserCreated = _user.UserID; } _objCate.Ads_ImgVideo = txtImageVideo.Text; //_objCate.Ads_Images = txtThumbnail.Text; //_objCate.AdvType = AdsPosDAL.getAdvType(txtThumbnail.Text); _objCate.Possittion = 1; if (txtOrder.Text.Length > 0) { _objCate.Order_Number = int.Parse(txtOrder.Text); } _objCate.URL = Txt_DiachiQC.Text; _objCate.DisplayType = txtMota.Text; if (chkDisplay.Checked == true) { _objCate.Status = 1; } else { _objCate.Status = 0; } return(_objCate); }
public void LoadData() { string where = " 1=1 AND Possittion = 1"; if (txt_tieude.Text.Trim().Length > 0) { where += " AND DisplayType LIKE " + string.Format("N'%{0}%'", UltilFunc.SqlFormatText(txt_tieude.Text.Trim())); } where += " Order by Order_Number ASC"; pages.PageSize = Global.MembersPerPage; HPCBusinessLogic.DAL.T_Customer_AdsDAL _cateDAL = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); DataSet _ds; _ds = _cateDAL.Bind_T_Customer_AdsDynamic(pages.PageIndex, pages.PageSize, where); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _cateDAL.Bind_T_Customer_AdsDynamic(pages.PageIndex - 1, pages.PageSize, where); } // DataView _dv = _cateDAL.BindGridCagegorys(_ds.Tables[0]); grdListCate.DataSource = _ds; grdListCate.DataBind(); _ds.Clear(); pages.TotalRecords = curentPages.TotalRecords = TotalRecords; curentPages.TotalPages = pages.CalculateTotalPages(); curentPages.PageIndex = pages.PageIndex; Session["PageIndex"] = pages.PageIndex; }
public override void DataBind() { if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["ID"]) == true) { HPCBusinessLogic.DAL.T_Customer_AdsDAL dal = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); int _id = Convert.ToInt32(Request["ID"].ToString()); PopulateItem(_id); } } }
protected void DeleteAdsByID(int AdsID) { HPCBusinessLogic.DAL.T_Customer_AdsDAL objAds_DAL = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); try { objAds_DAL.DeleteFrom_T_Customer_Ads(AdsID); } catch (Exception ex) { } finally { objAds_DAL = null; } }
protected void linkSave_Click(object sender, EventArgs e) { try { HPCBusinessLogic.DAL.T_Customer_AdsDAL _cateDAL = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); foreach (DataGridItem m_Item in grdListCate.Items) { TextBox txtPoss = (TextBox)m_Item.FindControl("txtPoss"); int intCategorysID = int.Parse(grdListCate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()); if (txtPoss.Text.Trim() != "") { bool bolUpdate = _cateDAL.UpdateOrderOfAdsLogo(intCategorysID, int.Parse(txtPoss.Text)); } } LoadData(); } catch (Exception ex) { HPCServerDataAccess.Lib.ShowAlertMessage(ex.Message.ToString()); } }
protected void linkSave_Click(object sender, EventArgs e) { if (Page.IsValid) { HPCBusinessLogic.DAL.T_Customer_AdsDAL _cateDAL = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); HPCInfo.T_Customer_Ads _catObj = GetObject(); if (_catObj.ID == 0) { int _return = _cateDAL.InsertT_Customer_Ads(_catObj); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "Khách hàng :" + cbo_Khachhang.SelectedItem.Text, Request["Menu_ID"].ToString(), "[CẬP NHẬT THÔNG LOGO QUẢNG CÁO]-->[Thêm mới thông tin quảng cáo]ID:" + _catObj.ID.ToString() + " ]", 0, 0); } else { _cateDAL.InsertT_Customer_Ads(_catObj); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "Khách hàng :" + cbo_Khachhang.SelectedItem.Text, Request["Menu_ID"].ToString(), "[CẬP NHẬT THÔNG LOGO QUẢNG CÁO]-->[Sửa thông tin quảng cáo]ID:" + _catObj.ID.ToString() + " ]", 0, 0); } Page.Response.Redirect("~/Quangcao/AdsLogoList.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString()); } }
private void PopulateItem(int _id) { HPCInfo.T_Customer_Ads _cateObj = new HPCInfo.T_Customer_Ads(); HPCBusinessLogic.DAL.T_Customer_AdsDAL _cateDAL = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); _cateObj = _cateDAL.load_T_Customer_Ads(_id); if (_cateObj != null) { Txt_DiachiQC.Text = _cateObj.URL.ToString(); txtOrder.Text = _cateObj.Order_Number.ToString(); txtImageVideo.Text = _cateObj.Ads_ImgVideo.ToString(); //txtThumbnail.Text = _cateObj.Ads_Images.ToString(); txtMota.Text = _cateObj.DisplayType.ToString(); if (_cateObj.Status == 1) { chkDisplay.Checked = true; } else { chkDisplay.Checked = false; } } }
protected string getListCategoryName(object AdsID) { HPCBusinessLogic.DAL.T_Customer_AdsDAL _objCusAdsDAL = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); return(_objCusAdsDAL.getListCategoryNameAds(int.Parse(AdsID.ToString()))); }
private HPCInfo.T_Customer_Ads GetObject() { HPCInfo.T_Customer_Ads _objCate = new HPCInfo.T_Customer_Ads(); HPCBusinessLogic.DAL.T_Customer_AdsDAL _CateDAL = new HPCBusinessLogic.DAL.T_Customer_AdsDAL(); if (Page.Request["id"] != null) { _objCate.ID = int.Parse(Page.Request["id"].ToString()); _objCate = _CateDAL.GetOneFromT_Customer_AdsByID(int.Parse(Page.Request["id"])); } else { _objCate.ID = 0; _objCate.DateCreated = DateTime.Now; _objCate.UserCreated = _user.UserID; } _objCate.Cat_ID = getListCateAdsDisplay(this.cbo_Category.SelectedValue.ToString()); if (int.Parse(cbo_Khachhang.SelectedIndex.ToString()) > 0) { _objCate.Cust_ID = int.Parse(cbo_Khachhang.SelectedValue); } if (int.Parse(cbo_lanquage.SelectedIndex.ToString()) > 0) { _objCate.Lang_ID = int.Parse(cbo_lanquage.SelectedValue); } _objCate.Ads_ImgVideo = txtImageVideo.Text; _objCate.Ads_Images = txtThumbnail.Text; _objCate.AdvType = AdsPosDAL.getAdvType(txtThumbnail.Text); if (!string.IsNullOrEmpty(txt_ngaybatdau.Text)) { _objCate.Start_Date = CommonLib.ToDate(txt_ngaybatdau.Text, "dd/MM/yyyy HH:mm:ss:tt"); } else { _objCate.Start_Date = DateTime.Now; } if (!string.IsNullOrEmpty(txt_ngayketthuc.Text)) { _objCate.End_Date = CommonLib.ToDate(txt_ngayketthuc.Text, "dd/MM/yyyy HH:mm:ss:tt"); } else { _objCate.End_Date = DateTime.Now; } if (int.Parse(cbo_Vitri_hienthi.SelectedValue.ToString()) > 0) { _objCate.Possittion = int.Parse(cbo_Vitri_hienthi.SelectedValue.ToString()); } if (txtOrder.Text.Length > 0) { _objCate.Order_Number = int.Parse(txtOrder.Text); } if (this.txtHeight.Text.Length > 0) { _objCate.Height = this.txtHeight.Text.Trim(); } if (this.txtWidth.Text.Length > 0) { if (UltilFunc.IsNumeric(this.txtWidth.Text.Trim())) { _objCate.Width = this.txtWidth.Text.Trim(); } } _objCate.URL = Txt_DiachiQC.Text; if (int.Parse(cbo_Display.SelectedIndex.ToString()) > 0) { _objCate.Target = int.Parse(cbo_Display.SelectedValue.ToString()); } _objCate.DisplayType = txtMota.Text; if (chkDisplay.Checked == true) { _objCate.Status = 1; } else { _objCate.Status = 0; } return(_objCate); }