protected void LinkNgungDang_Click(object sender, EventArgs e) { HPCBusinessLogic.T_Photo_EventDAL _untilDAL = new HPCBusinessLogic.T_Photo_EventDAL(); T_Photo_Event _obj = new T_Photo_Event(); T_Photo_EventDAL DAL = new T_Photo_EventDAL(); foreach (DataGridItem m_Item in grdListCate.Items) { CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect"); TextBox txtGhichu = (TextBox)m_Item.FindControl("txtGhichu"); TextBox txt_tienNB = m_Item.FindControl("txt_tienNB") as TextBox; if (chk_Select != null && chk_Select.Checked) { double id = double.Parse(grdListCate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()); _obj = DAL.GetOneFromT_Photo_EventsByID(id); //ghi chu T_Photo_Event _objNew = new T_Photo_Event(); _objNew = setItem(_obj.Photo_ID, _obj.Photo_Medium, _obj.Photo_Name, _obj.Lang_ID, _obj.Author_Name, txt_tienNB.Text, txtGhichu.Text, _obj.Photo_Status); int _return = _untilDAL.InsertT_Photo_Events(_objNew); //string _ActionsCode1 = "[Thời sự qua ảnh] [Duyệt ảnh thời sự] [Cập nhật ảnh] [Ảnh: " + _obj.Photo_Name + "]"; //WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Cập nhật]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode1, _return, ConstAction.TSAnh); // Update on Server Destinations _untilDAL.UpdateStatus_Photo_Events(id, 2, _user.UserID, DateTime.Now); string _ActionsCode = "[Thời sự qua ảnh] [Ngừng đăng ][Ảnh: " + _obj.Photo_Name + ""; WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Ngừng đăng]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, id, ConstAction.TSAnh); } } LoadData(this.txtPageIndex.Text.Trim()); }
public override void DataBind() { if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty) { this.lblTitleCaption.Text = "Cập nhật ảnh"; HPCBusinessLogic.T_Photo_EventDAL _DAL = new HPCBusinessLogic.T_Photo_EventDAL(); if (CommonLib.IsNumeric(Request["ID"]) == true) { int _id = Convert.ToInt32(Request["ID"].ToString()); PopulateItem(_id); } } else { this.lblTitleCaption.Text = "Thêm mới ảnh"; this.ImgTemp.Attributes.CssStyle.Add("display", "none"); if (cboNgonNgu.Items.Count == 2) { cboNgonNgu.SelectedIndex = 1; } else { cboNgonNgu.SelectedIndex = UltilFunc.GetIndexControl(cboNgonNgu, Global.DefaultCombobox); } } }
private void PopulateItem(int _id) { HPCInfo.T_Photo_Event _Obj = new HPCInfo.T_Photo_Event(); HPCBusinessLogic.T_Photo_EventDAL _untilDAL = new HPCBusinessLogic.T_Photo_EventDAL(); _Obj = _untilDAL.GetOneFromT_Photo_EventsByID(_id); if (_Obj != null) { this.txt_Abl_Photo_Name.Text = _Obj.Photo_Name.ToString(); this.txtThumbnail.Text = _Obj.Photo_Medium.ToString(); if (_Obj.Photo_Thumnail.Length > 2) { this.ImgTemp.Src = HPCComponents.Global.TinPathBDT + _Obj.Photo_Thumnail; } this.txt_Authod_Name.Text = _Obj.Author_Name.ToString(); if (_Obj.TienNB > 0.0) { this.txtTienNhuanBut.Text = string.Format("{0:#,#}", _Obj.TienNB).Replace(".", ","); } this.cboNgonNgu.SelectedIndex = UltilFunc.GetIndexControl(cboNgonNgu, _Obj.Lang_ID.ToString()); this.txtGhichu.Text = _Obj.Photo_Desc.ToString(); } //HPCInfo.T_Photo_Event _Obj = new HPCInfo.T_Photo_Event(); //HPCBusinessLogic.T_Photo_EventDAL _untilDAL = new HPCBusinessLogic.T_Photo_EventDAL(); //_Obj = _untilDAL.GetOneFromT_Photo_EventsByID(_id); //if (_Obj != null) //{ // txt_Abl_Photo_Name.Text = _Obj.Photo_Name.ToString(); // txtThumbnail.Text = _Obj.Photo_Medium.ToString(); // cboNgonNgu.SelectedIndex = UltilFunc.GetIndexControl(cboNgonNgu, _Obj.Lang_ID.ToString()); // this.txt_Authod_Name.Text = _Obj.Author_Name.ToString(); // if (_Obj.Photo_Thumnail.Length > 2) // this.ImgTemp.Src = HPCComponents.Global.TinPathBDT + _Obj.Photo_Thumnail; //} }
private void PopulateItem(int _id) { HPCInfo.T_Photo_Event _Obj = new HPCInfo.T_Photo_Event(); HPCBusinessLogic.T_Photo_EventDAL _untilDAL = new HPCBusinessLogic.T_Photo_EventDAL(); _Obj = _untilDAL.GetOneFromT_Photo_EventsByID(_id); if (_Obj != null) { this.txt_Abl_Photo_Name.Text = _Obj.Photo_Name.ToString(); this.txtThumbnail.Text = _Obj.Photo_Medium.ToString(); if (_Obj.Photo_Thumnail.Length > 2) { this.ImgTemp.Src = HPCComponents.Global.TinPathBDT + _Obj.Photo_Thumnail; } this.txt_Authod_Name.Text = _Obj.Author_Name.ToString(); this.cboNgonNgu.SelectedIndex = UltilFunc.GetIndexControl(cboNgonNgu, _Obj.Lang_ID.ToString()); this.txtGhichu.Text = _Obj.Photo_Desc.ToString(); } }
protected void linkSave_Click(object sender, EventArgs e) { //if (!Page.IsValid) return; HPCBusinessLogic.T_Photo_EventDAL _untilDAL = new HPCBusinessLogic.T_Photo_EventDAL(); HPCInfo.T_Photo_Event _Obj = GetObject(); if (_Obj.Photo_ID == 0) { int _return = _untilDAL.InsertT_Photo_Events(_Obj); string _ActionsCode = "[Thời sự qua ảnh] [Thêm mới ảnh] [Ảnh: " + _untilDAL.GetOneFromT_Photo_EventsByID(Convert.ToDouble(_return.ToString())).Photo_Name + "]"; WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Thêm mới]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, _return, ConstAction.TSAnh); System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("VALIDATE_ADDNEWS") + "');", true); } else { int _return = _untilDAL.InsertT_Photo_Events(_Obj); string _ActionsCode = "[Thời sự qua ảnh] [Cập nhật ảnh] [Ảnh: " + _Obj.Photo_Name + "]"; WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Cập nhật]", Convert.ToInt32(Request["Menu_ID"]), _ActionsCode, _return, ConstAction.TSAnh); System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("VALIDATE_ADDNEWS") + "');", true); } if (Page.Request["Tab"].ToString() != "-1") { if (Page.Request["Menu_ID"] != null) { Page.Response.Redirect("~/Anh24h/List_PhotosDexuat.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString() + "&Tab=" + Page.Request["Tab"].ToString()); } else { return; } } else { if (Page.Request["Menu_ID"] != null) { Page.Response.Redirect("~/Anh24h/List_PhotosDexuat.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString()); } else { return; } } }
protected void LinkDanganh_Click(object sender, EventArgs e) { //if (!Page.IsValid) return; #region SYNC HPCBusinessLogic.T_Photo_EventDAL _untilDAL = new HPCBusinessLogic.T_Photo_EventDAL(); T_Photo_Event _Obj = GetObject(); if (Request["id"] == null) { int _return = _untilDAL.InsertT_Photo_Events(_Obj); _untilDAL.UpdateStatus_Photo_Events(Convert.ToDouble(_return.ToString()), 8, _user.UserID, DateTime.Now); } else { _untilDAL.InsertT_Photo_Events(_Obj); _untilDAL.UpdateStatus_Photo_Events(_Obj.Photo_ID, 8, _user.UserID, DateTime.Now); } #endregion string _ActionsCode = "[Thời sự qua ảnh] [Gửi duyệt Ảnh] [Ảnh: " + _Obj.Photo_Name + "]"; //UltilFunc.WriteLogActionHistory(_user.UserID, _user.UserFullName, IpAddress(), _ActionsCode, 0, "[Gửi duyệt]", Convert.ToInt32(Request["Menu_ID"])); if (Page.Request["Tab"].ToString() != "-1") { if (Page.Request["Menu_ID"] != null) { Page.Response.Redirect("~/Anh24h/List_PhotosDexuat.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString() + "&Tab=" + Page.Request["Tab"].ToString()); } else { return; } } else { if (Page.Request["Menu_ID"] != null) { Page.Response.Redirect("~/Anh24h/List_PhotosDexuat.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString()); } else { return; } } }
public override void DataBind() { if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty) { HPCBusinessLogic.T_Photo_EventDAL _DAL = new HPCBusinessLogic.T_Photo_EventDAL(); if (CommonLib.IsNumeric(Request["ID"]) == true) { int _id = Convert.ToInt32(Request["ID"].ToString()); PopulateItem(_id); } } else { if (cboNgonNgu.Items.Count == 2) { cboNgonNgu.SelectedIndex = 1; } else { cboNgonNgu.SelectedIndex = UltilFunc.GetIndexControl(cboNgonNgu, Global.DefaultCombobox); } } }
public void LoadData(string PagesTextbox) { int PagesIndex = 0; bool boolCheckPages = true; if (PagesTextbox.Length > 0 && UltilFunc.IsNumeric(PagesTextbox.ToString())) { if (Convert.ToInt32(PagesTextbox) >= 1) { PagesIndex = Convert.ToInt32(PagesTextbox) - 1; } else { boolCheckPages = false; } } else { boolCheckPages = false; } string where = " 1=1 and Photo_Status=3 ";//AND Lang_ID IN (SELECT T_Nguoidung_NgonNgu.Ma_Ngonngu FROM T_Nguoidung_NgonNgu WHERE T_Nguoidung_NgonNgu.[Ma_Nguoidung] = " + _user.UserID + ") if (!String.IsNullOrEmpty(this.txtSearch_Cate.Text.Trim())) { where += " AND " + string.Format(" Photo_Name like N'%{0}%'", UltilFunc.SqlFormatText(this.txtSearch_Cate.Text.Trim())); } if (cboNgonNgu.SelectedIndex > 0) { where += " AND Lang_ID=" + cboNgonNgu.SelectedValue.ToString(); } if (txt_FromDate.Text.Length > 0 && txt_ToDate.Text.Length == 0) { where += " and Date_Create>='" + txt_FromDate.Text + " 00:00:01'"; } else if (txt_FromDate.Text.Length == 0 && txt_ToDate.Text.Length > 0) { where += " AND Date_Update < ='" + txt_ToDate.Text.Trim() + " 23:59:59'"; } else if (txt_FromDate.Text.Length > 0 && txt_ToDate.Text.Length > 0) { where += " and Date_Update>='" + txt_FromDate.Text + " 00:00:01' and Date_Create<='" + txt_ToDate.Text + " 23:59:59'"; } where += " Order by Date_Update DESC"; pages.PageSize = Global.MembersPerPage; HPCBusinessLogic.T_Photo_EventDAL _cateDAL = new HPCBusinessLogic.T_Photo_EventDAL(); DataSet _ds; if (boolCheckPages) { _ds = _cateDAL.BindGridT_Photo_Events(PagesIndex, pages.PageSize, where); } else { _ds = _cateDAL.BindGridT_Photo_Events(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) { if (boolCheckPages) { _ds = _cateDAL.BindGridT_Photo_Events(PagesIndex - 1, pages.PageSize, where); } else { _ds = _cateDAL.BindGridT_Photo_Events(pages.PageIndex - 1, pages.PageSize, where); } } grdListCate.DataSource = _ds; grdListCate.DataBind(); _ds.Clear(); pages.TotalRecords = curentPages.TotalRecords = TotalRecords; curentPages.TotalPages = pages.CalculateTotalPages(); if (boolCheckPages) { curentPages.PageIndex = PagesIndex; } else { curentPages.PageIndex = pages.PageIndex; } }
private void LoadData(int status) { string where = " 1=1 "; if (status == 5 || status == 7) { where += " and Creator=" + _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name).UserID + " AND Photo_Status = " + status + " AND Lang_ID IN (SELECT T_Nguoidung_NgonNgu.Ma_Ngonngu FROM T_Nguoidung_NgonNgu WHERE T_Nguoidung_NgonNgu.[Ma_Nguoidung] = " + _user.UserID + ")"; } else { where += " and Photo_Status = " + status + " AND Lang_ID IN (SELECT DISTINCT(T_Nguoidung_NgonNgu.Ma_Ngonngu) FROM T_Nguoidung_NgonNgu WHERE T_Nguoidung_NgonNgu.[Ma_Nguoidung] = " + _user.UserID + ")"; } where += " Order by Date_Create DESC"; pages.PageSize = 50; HPCBusinessLogic.T_Photo_EventDAL _untilDAL = new HPCBusinessLogic.T_Photo_EventDAL(); DataSet _ds; _ds = _untilDAL.BindGridT_Photo_Events(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 = _untilDAL.BindGridT_Photo_Events(pages.PageIndex - 1, pages.PageSize, where); } grdListCate.DataSource = _ds; grdListCate.DataBind(); _ds.Clear(); if (TotalRecords == 0) { pages.Visible = false; curentPages.Visible = false; } pages.TotalRecords = curentPages.TotalRecords = TotalRecords; curentPages.TotalPages = pages.CalculateTotalPages(); curentPages.PageIndex = pages.PageIndex; if (grdListCate.Items.Count > 0) { int count = 0; foreach (DataGridItem m_Item in grdListCate.Items) { T_Photo_EventDAL _DAL = new T_Photo_EventDAL(); T_Photo_Event _obj = new T_Photo_Event(); ImageButton btnModify = m_Item.FindControl("btnModify") as ImageButton; ImageButton btnSave = m_Item.FindControl("btnSave") as ImageButton; ImageButton btnBack = m_Item.FindControl("btnBack") as ImageButton; Label lblNgonNgu = m_Item.FindControl("lblNgonNgu") as Label; LinkButton btnEdit = m_Item.FindControl("btnEdit") as LinkButton; Label lblTacGia = m_Item.FindControl("lblTacGia") as Label; DropDownList cboNgonNgu = m_Item.FindControl("cboNgonNgu") as DropDownList; TextBox txtTitle = m_Item.FindControl("txtTitle") as TextBox; TextBox txtTacGia = m_Item.FindControl("txt_tacgia") as TextBox; //Image imgView = m_Item.FindControl("imgView") as Image; //Image imgBrowse = m_Item.FindControl("imgBrowse") as Image; if (txtTitle.Text.Trim().Length > 0) { btnSave.Visible = false; btnBack.Visible = false; btnModify.Visible = true; lblNgonNgu.Visible = true; lblTacGia.Visible = true; btnEdit.Visible = true; cboNgonNgu.Visible = false; txtTitle.Visible = false; txtTacGia.Visible = false; //imgView.Visible = true; //imgBrowse.Visible = false; } else { btnSave.Visible = true; btnBack.Visible = true; btnModify.Visible = false; lblNgonNgu.Visible = false; lblTacGia.Visible = false; btnEdit.Visible = false; cboNgonNgu.Visible = true; txtTitle.Visible = true; txtTacGia.Visible = true; //imgView.Visible = false; //imgBrowse.Visible = true; if (count == 0) { txtTitle.Focus(); } count++; } } } }