protected void link_duyet_Click(object sender, EventArgs e) { HPCBusinessLogic.DAL.T_Album_CategoriesDAL T_Album = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL(); if (TabContainer1.ActiveTabIndex == 0) { foreach (DataGridItem item in DataGrid_Choduyet.Items) { Label lblcatid = (Label)item.FindControl("lblcatid"); CheckBox check = (CheckBox)item.FindControl("optSelect"); if (check.Checked) { int _id = Convert.ToInt32(lblcatid.Text); T_Album.Update_Status(_id, 4, _user.UserID); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "Xuất bản", Request["Menu_ID"].ToString(), "[Phóng sự ảnh chờ duyệt] [Duyệt Phóng sự ảnh: " + T_Album.load_T_Album_Categories(Convert.ToInt32(lblcatid.Text)).Cat_Album_Name + "]", _id, ConstAction.GocAnh); #region Sync // DONG BO ANH try { SynFiles _syncfile = new SynFiles(); T_Album_PhotoDAL _cateDAL = new T_Album_PhotoDAL(); DataSet _ds = _cateDAL.Bind_T_Album_Photo(int.Parse(lblcatid.Text)); foreach (DataRow theRow in _ds.Tables[0].Rows) { string _img = theRow["Abl_Photo_Origin"].ToString(); if (_img.Trim().Length > 0) { _syncfile.SynData_UploadImgOne(_img, Global.ImagesService); } } } catch (Exception) { throw; } //END #endregion } } LoadPSchoduyet(); } else if (TabContainer1.ActiveTabIndex == 1) { foreach (DataGridItem item in DataGrid_HuyXB.Items) { Label lblcatid = (Label)item.FindControl("lblcatid"); CheckBox check = (CheckBox)item.FindControl("optSelect"); if (check.Checked) { int _id = int.Parse(lblcatid.Text); T_Album.Update_Status(_id, 4, _user.UserID); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "Xuất bản", Request["Menu_ID"].ToString(), "[Phóng sự ảnh hủy xuất bản] [Duyệt Phóng sự ảnh: " + T_Album.load_T_Album_Categories(Convert.ToInt32(lblcatid.Text)).Cat_Album_Name + "]", _id, ConstAction.GocAnh); #region Sync // DONG BO ANH try { SynFiles _syncfile = new SynFiles(); T_Album_PhotoDAL _cateDAL = new T_Album_PhotoDAL(); DataSet _ds = _cateDAL.Bind_T_Album_Photo(int.Parse(lblcatid.Text)); foreach (DataRow theRow in _ds.Tables[0].Rows) { string _img = theRow["Abl_Photo_Origin"].ToString(); if (_img.Trim().Length > 0) { _syncfile.SynData_UploadImgOne(_img, Global.ImagesService); } } } catch (Exception) { throw; } //END #endregion } } LoadPShuyXB(); } }
protected void linkSave_Click(object sender, EventArgs e) { try { #region "Duyet danh sach cac doi tuong tren luoi" HPCBusinessLogic.DAL.T_Album_PhotoDAL _cateDAL = new HPCBusinessLogic.DAL.T_Album_PhotoDAL(); HPCInfo.T_Album_Photo _catObj; bool checktien = true; foreach (DataGridItem m_Item in grdListCate.Items) { TextBox txt_tienNB = (TextBox)m_Item.FindControl("txt_tienNB"); if (!string.IsNullOrEmpty(txt_tienNB.Text)) { try { int.Parse(txt_tienNB.Text.Replace(",", "")); } catch { checktien = false; } } } if (checktien) { HPCBusinessLogic.DAL.T_ButdanhDAL obj = new HPCBusinessLogic.DAL.T_ButdanhDAL(); foreach (DataGridItem m_Item in grdListCate.Items) { T_Butdanh obj_BD = new T_Butdanh(); TextBox txtTitle = (TextBox)m_Item.FindControl("txtTitle"); TextBox txt_tienNB = (TextBox)m_Item.FindControl("txt_tienNB"); TextBox txtDesc = (TextBox)m_Item.FindControl("txtDesc"); TextBox txttacgia = (TextBox)m_Item.FindControl("txt_tacgia"); TextBox txt_tacgiaID = (TextBox)m_Item.FindControl("txt_tacgiaID"); TextBox txt_OrderByPhoto = (TextBox)m_Item.FindControl("txt_OrderByPhoto"); Label lblUrlPath = (Label)m_Item.FindControl("lblUrlPath"); //CheckBox _chkIsHomeAlbum = (CheckBox)m_Item.FindControl("chkIsHomeAlbum"); int tien = 0; if (!string.IsNullOrEmpty(txt_tienNB.Text)) { try { tien = int.Parse(txt_tienNB.Text.Replace(",", "")); } catch {; } } int intPhotoID = Convert.ToInt32(grdListCate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()); int butdanhID = 0; if (!string.IsNullOrEmpty(txttacgia.Text.Trim())) { obj_BD.BD_ID = 0; obj_BD.BD_Name = txttacgia.Text.Trim(); obj_BD.UserID = _user.UserID; butdanhID = obj.Insert_Butdang(obj_BD); } _catObj = setItem(intPhotoID, txtTitle.Text, txtDesc.Text, Convert.ToInt32(txt_OrderByPhoto.Text), tien, txttacgia.Text, butdanhID); _cateDAL.InsertT_Album_Photo(_catObj); } LoadData(cat_id); } else { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("lblXacnhanTien") + "');", true); } #region Sync // DONG BO ANH int pageback = 0; try { pageback = int.Parse(Session["PageFromID"].ToString()); } catch {; } if (pageback == 3) { SynFiles _syncfile = new SynFiles(); T_Album_PhotoDAL _DAL = new T_Album_PhotoDAL(); DataSet _ds = _DAL.Bind_T_Album_Photo(cat_id); foreach (DataRow theRow in _ds.Tables[0].Rows) { string _img = theRow["Abl_Photo_Origin"].ToString(); if (_img.Trim().Length > 0) { _syncfile.SynData_UploadImgOne(_img, Global.ImagesService); } } } //END #endregion this.litMessages.Text = "Lưu giữ thành công"; #endregion } catch (Exception ex) { HPCServerDataAccess.Lib.ShowAlertMessage(ex.Message.ToString()); } }
protected void linkSave_Click(object sender, EventArgs e) { if (Page.IsValid) { int pageback = 0; try { pageback = int.Parse(Session["PageFromID"].ToString()); } catch {; } if (pageback == 2 || pageback == 3) { if (!string.IsNullOrEmpty(txt_tiennhanbut.Text)) { try { int.Parse(txt_tiennhanbut.Text.Replace(",", "")); } catch { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + CommonLib.ReadXML("lblXacnhanTien") + "');", true); return; } } } HPCBusinessLogic.DAL.T_Album_CategoriesDAL _cateDAL = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL(); string strActionNotes = ""; HPCInfo.T_Album_Categories _catObj = GetObject(); int _return = _cateDAL.InsertT_Album_Categories(_catObj); if (_catObj.Cat_Album_ID == 0) { strActionNotes = "[Thêm mới] [Thêm mới Phóng sự ảnh: " + _cateDAL.load_T_Album_Categories(_return).Cat_Album_Name + "]"; } else { strActionNotes = "[Cập nhật] [Cập nhật Phóng sự ảnh: " + _cateDAL.load_T_Album_Categories(_return).Cat_Album_Name + "]"; } WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, _catObj.Cat_Album_Name, Request["Menu_ID"].ToString(), strActionNotes, 0, ConstAction.GocAnh); if (pageback == 3) { #region Sync // DONG BO ANH try { SynFiles _syncfile = new SynFiles(); T_Album_PhotoDAL _DAL = new T_Album_PhotoDAL(); DataSet _ds = _DAL.Bind_T_Album_Photo(_return); foreach (DataRow theRow in _ds.Tables[0].Rows) { string _img = theRow["Abl_Photo_Origin"].ToString(); if (_img.Trim().Length > 0) { _syncfile.SynData_UploadImgOne(_img, Global.ImagesService); } } } catch (Exception) { throw; } //END #endregion } if (_catObj.Cat_Album_ID == 0) { ResetForm(); Response.Redirect("~/PhongSuAnh/Album_List.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString() + "&Back=1"); } else { if (pageback == 1) { Response.Redirect("~/PhongSuAnh/Album_List.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString() + "&Back=1"); } else if (pageback == 2) { Response.Redirect("~/PhongSuAnh/Approves_List.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString() + "&Back=1"); } else if (pageback == 3) { Response.Redirect("~/PhongSuAnh/Approved_List.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString() + "&Back=1"); } else { Response.Redirect("~/PhongSuAnh/Album_List.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString()); } } } }