Beispiel #1
0
 private HPCInfo.T_Album_Categories PopulateItem(int _id)
 {
     HPCInfo.T_Album_Categories _cateObj = new HPCInfo.T_Album_Categories();
     HPCBusinessLogic.DAL.T_Album_CategoriesDAL _cateDAL = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
     _cateObj = _cateDAL.load_T_Album_Categories(_id);
     return(_cateObj);
 }
 protected void link_copy_Click(object sender, EventArgs e)
 {
     HPCBusinessLogic.DAL.T_Album_CategoriesDAL T_Album = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
     if (TabContainer1.ActiveTabIndex == 0)
     {
         //string listId = "";
         //int count = 0;
         //foreach (DataGridItem item in dgData_ChoXuatban.Items)
         //{
         //    Label lblcatid = (Label)item.FindControl("lblcatid");
         //    CheckBox check = (CheckBox)item.FindControl("optSelect");
         //    if (check.Checked)
         //    {
         //        if (count == 0)
         //        {
         //            listId = lblcatid.Text;
         //        }
         //        else
         //        {
         //            listId += "," + lblcatid.Text;
         //        }
         //        count++;
         //    }
         //}
         //lbl_News_ID.Text = listId;
         LoadCM();
         ModalPopupExtender1.Show();
     }
 }
        public void LoadPSdaduyet()
        {
            Pager_daduyet.PageSize = Global.MembersPerPage;
            HPCBusinessLogic.DAL.T_Album_CategoriesDAL _cateDAL = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
            DataSet _ds;

            _ds = _cateDAL.Bind_T_Album_CategoriesDynamic(Pager_daduyet.PageIndex, Pager_daduyet.PageSize, WhereCondition(2));
            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_Album_CategoriesDynamic(Pager_daduyet.PageIndex - 1, Pager_daduyet.PageSize, WhereCondition(2));
            }
            DataGrid_daduyet.DataSource = _ds;
            DataGrid_daduyet.DataBind(); _ds.Clear();
            Pager_daduyet.TotalRecords     = CurrentPage_daduyet.TotalRecords = TotalRecords;
            CurrentPage_daduyet.TotalPages = Pager_daduyet.CalculateTotalPages();
            CurrentPage_daduyet.PageIndex  = Pager_daduyet.PageIndex;
            GetTotal();
            foreach (DataGridItem item in DataGrid_daduyet.Items)
            {
                ImageButton btnview  = (ImageButton)item.FindControl("btnViewPhoto");
                Label       lblcatid = (Label)item.FindControl("lblcatid");
                btnview.Attributes.Add("onclick", "PopupWindow('T_Album_Categories_View.aspx?catps=" + lblcatid.Text + "')");
                item.Attributes.Add("onmouseover", "currColor=this.style.backgroundColor;this.style.backgroundColor='" + CommonLib.HPCOnmouseoverGrid() + "'");
                item.Attributes.Add("onmouseout", "this.style.backgroundColor=currColor");
            }
        }
 private ServicesInfor.Album_Categories SetItemSyn(int _ID)
 {
     ServicesInfor.Album_Categories             obj       = new ServicesInfor.Album_Categories();
     HPCInfo.T_Album_Categories                 _objGet   = new T_Album_Categories();
     HPCBusinessLogic.DAL.T_Album_CategoriesDAL _untilDAL = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
     _objGet = _untilDAL.load_T_Album_Categories(_ID);
     if (Page.Request.Params["ID"] != null)
     {
         obj.Cat_Album_ID = _objGet.Cat_Album_ID;
     }
     else
     {
         obj.Cat_Album_ID = _objGet.Cat_Album_ID;
     }
     obj.Cat_Album_Name = _objGet.Cat_Album_Name;
     obj.Cat_AlbumDesc  = _objGet.Cat_AlbumDesc;
     obj.Copy_From      = _objGet.Copy_From;
     if (txtOrder.Text.Length > 0)
     {
         if (UltilFunc.IsNumeric(this.txtOrder.Text.Trim()))
         {
             obj.Possition = _objGet.Possition;
         }
     }
     obj.Links   = _objGet.Links;
     obj.Lang_ID = _objGet.Lang_ID;
     obj.Status  = _objGet.Status;
     obj.Target  = _objGet.Target;
     return(obj);
 }
 protected void link_tralai_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");
             int      _id      = int.Parse(lblcatid.Text);
             CheckBox check    = (CheckBox)item.FindControl("optSelect");
             if (check.Checked)
             {
                 T_Album.Update_Status(_id, 3, _user.UserID);
             }
             WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "Trả lại", Request["Menu_ID"].ToString(), "[Phóng sự ảnh chờ duyệt] [Trả lại Phóng sự ảnh: " + T_Album.load_T_Album_Categories(Convert.ToInt32(lblcatid.Text)).Cat_Album_Name + "]", _id, ConstAction.GocAnh);
         }
         LoadPSchoduyet();
     }
     else if (TabContainer1.ActiveTabIndex == 1)
     {
         foreach (DataGridItem item in DataGrid_HuyXB.Items)
         {
             Label    lblcatid = (Label)item.FindControl("lblcatid");
             int      _id      = int.Parse(lblcatid.Text);
             CheckBox check    = (CheckBox)item.FindControl("optSelect");
             if (check.Checked)
             {
                 T_Album.Update_Status(_id, 3, _user.UserID);
             }
             WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "Trả lại", Request["Menu_ID"].ToString(), "[Phóng sự ảnh hủy xuất bản] [Trả lại Phóng sự ảnh: " + T_Album.load_T_Album_Categories(Convert.ToInt32(lblcatid.Text)).Cat_Album_Name + "]", _id, ConstAction.GocAnh);
         }
         LoadPShuyXB();
     }
 }
 protected void link_copy_Click(object sender, EventArgs e)
 {
     HPCBusinessLogic.DAL.T_Album_CategoriesDAL T_Album = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
     if (TabContainer1.ActiveTabIndex == 0)
     {
         LoadCM();
         ModalPopupExtender1.Show();
     }
 }
 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_Album_CategoriesDAL dal = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
             int _id = Convert.ToInt32(Request["ID"].ToString());
             if (CheckPermission(_id))
             {
                 PopulateItem(_id);
                 if (dal.load_T_Album_Categories(_id).Lang_ID != 1)
                 {
                     cbo_lanquage.Enabled = false;
                 }
                 else
                 {
                     cbo_lanquage.Enabled = true;
                 }
             }
         }
     }
     else
     {
         if (cbo_lanquage.SelectedIndex > 0)
         {
             cbo_chuyenmuc.Items.Clear();
             if (cbo_lanquage.SelectedIndex >= 0)
             {
                 UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham= " + this.cbo_lanquage.SelectedValue + " AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
                 cbo_chuyenmuc.UpdateAfterCallBack = true;
             }
             else
             {
                 this.cbo_chuyenmuc.DataSource = null;
                 this.cbo_chuyenmuc.DataBind();
                 this.cbo_chuyenmuc.UpdateAfterCallBack = true;
             }
         }
     }
 }
 private void PopulateItem(int _id)
 {
     HPCInfo.T_Album_Categories _cateObj = new HPCInfo.T_Album_Categories();
     HPCBusinessLogic.DAL.T_Album_CategoriesDAL _cateDAL = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
     _cateObj = _cateDAL.load_T_Album_Categories(_id);
     if (_cateObj != null)
     {
         Txt_tieudeAbum.Text             = _cateObj.Cat_Album_Name.ToString();
         txt_noidungAlbum.Text           = _cateObj.Cat_AlbumDesc.ToString();
         txtOrder.Text                   = _cateObj.Possition.ToString();
         lbl_status.Text                 = _cateObj.Cat_Album_Status_Approve.ToString();
         this.cbo_lanquage.SelectedValue = _cateObj.Lang_ID.ToString();
         this.cbo_chuyenmuc.Items.Clear();
         if (cbo_lanquage.SelectedIndex > 0)
         {
             UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 and Ma_AnPham= " + this.cbo_lanquage.SelectedValue + " AND Ma_ChuyenMuc IN ({0})", UltilFunc.GetCategory4User(_user.UserID)), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC");
             cbo_chuyenmuc.UpdateAfterCallBack = true;
             cbo_chuyenmuc.SelectedIndex       = CommonLib.GetIndexControl(cbo_chuyenmuc, _cateObj.Cat_Album_CATID.ToString());
         }
         else
         {
             this.cbo_chuyenmuc.DataSource = null;
             this.cbo_chuyenmuc.DataBind();
             this.cbo_chuyenmuc.UpdateAfterCallBack = true;
         }
         //ddlnews_chatluong.SelectedIndex = _cateObj.Chatluong;
         txt_Author_name.Text = _cateObj.Tacgia;
         if (_cateObj.TongtienTT > 0)
         {
             if (_cateObj.TongtienTT > 0)
             {
                 this.txt_tiennhanbut.Text = string.Format("{0:#,#}", _cateObj.TongtienTT).Replace(".", ",");
             }
         }
         this.txtGhichu.Text = _cateObj.Comment;
         HPCBusinessLogic.DAL.T_ButdanhDAL obj = new HPCBusinessLogic.DAL.T_ButdanhDAL();
         this.txt_Author_name.Text = obj.GetBD_Name(_cateObj.AuthorID);
     }
 }
Beispiel #9
0
        public bool CheckPermission(int CatID)
        {
            HPCInfo.T_Album_Categories _cateObj = new HPCInfo.T_Album_Categories();
            HPCBusinessLogic.DAL.T_Album_CategoriesDAL _cateDAL = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL();
            _cateObj = _cateDAL.load_T_Album_Categories(CatID);
            Double trangthai = _cateObj.Cat_Album_Status_Approve;
            int    pageback  = 0;

            try { pageback = Convert.ToInt32(Session["PageFromID"].ToString()); }
            catch {; }
            if (pageback == 1)// chuc nang bien tap
            {
                if (trangthai != 1 && trangthai != 3)
                {
                    FileUpload1.Visible = false;
                    linkSave.Enabled    = false;
                    LinkCancel.Enabled  = false;
                    return(false);
                }
                else
                {
                    FileUpload1.Visible = true;
                    linkSave.Enabled    = true;
                    LinkCancel.Enabled  = true;
                    return(true);
                }
            }
            else if (pageback == 2)// chuc nang duyet bai
            {
                if (trangthai != 2 && trangthai != 5)
                {
                    FileUpload1.Visible = false;
                    linkSave.Enabled    = false;
                    LinkCancel.Enabled  = false;
                    return(false);
                }
                else
                {
                    FileUpload1.Visible = true;
                    linkSave.Enabled    = true;
                    LinkCancel.Enabled  = true;
                    return(true);
                }
            }
            else if (pageback == 3)// chuc nang xuat ban
            {
                if (trangthai != 4)
                {
                    FileUpload1.Visible = false;
                    linkSave.Enabled    = false;
                    LinkCancel.Enabled  = false;
                    return(false);
                }
                else
                {
                    FileUpload1.Visible = true;
                    linkSave.Enabled    = true;
                    LinkCancel.Enabled  = true;
                    return(true);
                }
            }
            else
            {
                FileUpload1.Visible = false;
                linkSave.Enabled    = false;
                LinkCancel.Enabled  = false;
                return(false);
            }
        }
        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();
            }
        }
Beispiel #11
0
        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());
                    }
                }
            }
        }