Esempio n. 1
0
 public void grdList_EditCommand(object source, DataGridCommandEventArgs e)
 {
     #region GhiLog
     Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL();
     T_Lichsu_Thaotac_Hethong  action    = new T_Lichsu_Thaotac_Hethong();
     action.Ma_Nguoidung = _user.UserID;
     action.TenDaydu     = _user.UserFullName;
     action.HostIP       = IpAddress();
     action.NgayThaotac  = DateTime.Now;
     #endregion
     ChuyenmucDAL obj_Cate = new ChuyenmucDAL();
     int          catID    = Convert.ToInt32(this.grdListCate.DataKeys[e.Item.ItemIndex].ToString());
     if (e.CommandArgument.ToString().ToLower() == "edit")
     {
         Response.Redirect("~/Danhmuc/EditChuyenMuc.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + catID);
     }
     if (e.CommandArgument.ToString().ToLower() == "editdisplay")
     {
         bool check = obj_Cate.GetOneFromT_ChuyenmucByID(catID).HoatDong;
         if (check)
         {
             obj_Cate.UpdateFromT_ChuyenMucDynamic(" Hoatdong = 0, Ngaysua = Getdate(), Nguoisua=" + _user.UserID.ToString() + " Where Ma_ChuyenMuc = " + catID);
             action.Thaotac = "[Update T_ChuyenMuc]-->[Hoatdong = 0]";
         }
         else
         {
             obj_Cate.UpdateFromT_ChuyenMucDynamic(" Hoatdong = 1, Ngaysua = Getdate(), Nguoisua=" + _user.UserID.ToString() + " Where Ma_ChuyenMuc = " + catID);
             action.Thaotac = "[Update T_ChuyenMuc]-->[Hoatdong = 1]";
         }
     }
     if (e.CommandArgument.ToString().ToLower() == "active_bdt")
     {
         bool check = obj_Cate.GetOneFromT_ChuyenmucByID(catID).HienThi_BDT;
         if (check)
         {
             obj_Cate.UpdateFromT_ChuyenMucDynamic(" HienThi_BDT = 0, Ngaysua = Getdate(), Nguoisua=" + _user.UserID.ToString() + " Where Ma_ChuyenMuc = " + catID);
             action.Thaotac = "[Update T_ChuyenMuc]-->[HienThi_BDT = 0]";
         }
         else
         {
             obj_Cate.UpdateFromT_ChuyenMucDynamic(" HienThi_BDT = 1, Ngaysua = Getdate(), Nguoisua=" + _user.UserID.ToString() + " Where Ma_ChuyenMuc = " + catID);
             action.Thaotac = "[Update T_ChuyenMuc]-->[HienThi_BDT = 1]";
         }
     }
     if (e.CommandArgument.ToString().ToLower() == "delete")
     {
         if (obj_Cate.CheckExists_ChuyenMuc(catID) == 0)
         {
             obj_Cate.DeleteFromT_ChuyenmucByID(catID);
             action.Thaotac = "[Xóa T_ChuyenMuc]-->[Thao tác Xóa Trong Bảng T_ChuyenMuc][ID:" + this.grdListCate.DataKeys[e.Item.ItemIndex].ToString() + " ]";
         }
         else
         {
             FuncAlert.AlertJS(this, "chuyên mục đã được sử dung biên tập tin bài!");
             return;
         }
     }
     Danhsach_ChuyenMuc();
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = int.Parse(Page.Request.QueryString["ID"].ToString());

            if (!IsPostBack)
            {
                if (Page.Request.QueryString["Menu_ID"] != null)
                {
                    T_Tulieu obj = new T_Tulieu();
                    obj = Daltinbai.load_T_Tulieu(id);

                    if (obj.Sotu != 0)
                    {
                        Sotu = obj.Sotu.ToString();
                    }
                    else
                    {
                        Sotu = "0";
                    }


                    Chuyenmuc = dalcm.GetOneFromT_ChuyenmucByID(obj.Ma_Chuyenmuc).Ten_ChuyenMuc;

                    Noidung = obj.Noidung.ToString();
                    Tacgia  = obj.TacGia;
                }
            }
        }
Esempio n. 3
0
        private void GetItem(int _id)
        {
            T_ChuyenMuc  _objChuyenmuc = new T_ChuyenMuc();
            ChuyenmucDAL _chuyenmucDAL = new ChuyenmucDAL();

            _objChuyenmuc      = _chuyenmucDAL.GetOneFromT_ChuyenmucByID(_id);
            this.txtTenCM.Text = _objChuyenmuc.Ten_ChuyenMuc;
            this.txtThum.Text  = _objChuyenmuc.Anh_ChuyenMuc;
            if (_objChuyenmuc.Anh_ChuyenMuc.ToString().Length > 0)
            {
                this.ImgTemp.Src = HPCComponents.Global.UploadPathBDT + _objChuyenmuc.Anh_ChuyenMuc;
            }
            else
            {
                this.ImgTemp.Attributes.CssStyle.Add("display", "none");
            }

            this.ddl_ChuyenMucCha.SelectedIndex = UltilFunc.GetIndexControl(ddl_ChuyenMucCha, _objChuyenmuc.Ma_Chuyenmuc_Cha.ToString());
            this.cbo_Anpham.SelectedIndex       = UltilFunc.GetIndexControl(cbo_Anpham, _objChuyenmuc.Ma_AnPham.ToString());
            this.chk_Hoatdong.Checked           = _objChuyenmuc.HoatDong;
            this.txt_stt.Text           = _objChuyenmuc.ThuTuHienThi.ToString();
            this.CheckBoxBaoIn.Checked  = _objChuyenmuc.HienThi_BaoIn;
            this.CheckBoxBaoDT.Checked  = _objChuyenmuc.HienThi_BDT;
            this.CheckBoxRss.Checked    = _objChuyenmuc.HienThi_RSS;
            this.CheckBoxCD.Checked     = _objChuyenmuc.ChuyenDe;
            this.CheckBoxButtom.Checked = _objChuyenmuc.HienThiDuoi;
            this.CheckBoxCenter.Checked = _objChuyenmuc.HienThiGiua;
            this.CheckBoxRight.Checked  = _objChuyenmuc.HienThiPhai;
            this.CheckBoxLeft.Checked   = _objChuyenmuc.HienThiTrai;
            this.CheckBoxTop.Checked    = _objChuyenmuc.HienThiTren;
            this.chkHienThi.Checked     = _objChuyenmuc.HienThi;
        }
        public string GetCategoryName(Object ID, Object loaiid)
        {
            string       str  = "";
            ChuyenmucDAL _dal = new ChuyenmucDAL();

            if (_dal.GetOneFromT_ChuyenmucByID(Convert.ToInt32(loaiid)) != null)
            {
                string loaitinbaiID = "", loaianhID = "", loaivideoID = "", loaianhTsID = "";
                loaitinbaiID = ConfigurationManager.AppSettings["NewsType"].ToString();
                loaianhID    = ConfigurationManager.AppSettings["ImageType"].ToString();
                loaivideoID  = ConfigurationManager.AppSettings["VideoType"].ToString();;
                loaianhTsID  = ConfigurationManager.AppSettings["AnhTSType"].ToString();
                if (loaiid.ToString().Trim() == loaitinbaiID)
                {
                    try
                    {
                        if (_dal.GetOneFromT_ChuyenmucByID(Convert.ToInt32(ID)) == null)
                        {
                            str = "";
                        }
                        else
                        {
                            str = _dal.GetOneFromT_ChuyenmucByID(Convert.ToInt32(ID)).Ten_ChuyenMuc.ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else if (loaiid.ToString().Trim() == loaianhID)
                {
                    str = "Góc ảnh";
                }
                else if (loaiid.ToString().Trim() == loaivideoID)
                {
                    str = "Âm thanh - Hình ảnh";
                }
                else if (loaiid.ToString().Trim() == loaianhTsID)
                {
                    str = "Thời sự qua ảnh";
                }
            }
            return(str);
        }
Esempio n. 5
0
        protected void Save_Click(object sender, EventArgs e)
        {
            string Thaotac = string.Empty;

            this.Page.Validate(vs_Themmoi.ValidationGroup);
            if (!Page.IsValid)
            {
                return;
            }
            ChuyenmucDAL _ChuyenMucDAL = new ChuyenmucDAL();
            T_ChuyenMuc  _ChuyenMuc    = SetItem();

            if (cbo_Anpham.SelectedIndex == 0)
            {
                FuncAlert.AlertJS(this, "Bạn chưa chọn ấn phẩm!");
                return;
            }
            else
            {
                int menuID = 0;
                if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty)
                {
                    menuID = int.Parse(Request["ID"].ToString());
                }
                int _return = _ChuyenMucDAL.Insert_T_Chuyenmuc(_ChuyenMuc);
                // DONG BO FILE
                _ChuyenMuc = _ChuyenMucDAL.GetOneFromT_ChuyenmucByID(_return);
                SynFiles _syncfile = new SynFiles();
                if (_ChuyenMuc.Anh_ChuyenMuc.Length > 0)
                {
                    _syncfile.SynData_UploadImgOne(_ChuyenMuc.Anh_ChuyenMuc, HPCComponents.Global.ImagesService);
                }
                //END
                if (Page.Request.Params["id"] == null)
                {
                    Thaotac = "[Thêm mới Chuyên mục]-->[mã chuyên mục:" + _return.ToString() + " ]";
                    Clear();
                    BindCombo();
                }
                if (Page.Request.Params["id"] != null)
                {
                    Thaotac = "[Sửa chuyên mục]-->[Mã chuyên mục:" + Page.Request["id"].ToString() + " ]";
                    Clear();
                    BindCombo();
                }
            }
        }
Esempio n. 6
0
        private void Save_GroupCategorys(int Group_ID)
        {
            NguoidungDAL _usermenuDAL  = new NguoidungDAL();
            ChuyenmucDAL _ChuyenmucDAL = new ChuyenmucDAL();
            T_ChuyenMuc  _objcm        = new T_ChuyenMuc();
            UltilFunc    ulti          = new UltilFunc();
            int          Cate_ID       = 0;

            string[] arrCate;
            char[]   sepparator;
            sepparator = ";".ToCharArray();
            if (txtCateAccess.Value.Trim() != "")
            {
                arrCate = txtCateAccess.Value.Split(sepparator);
                string txt = "";
                if (txtCateAccess.Value.StartsWith("on;"))
                {
                    txt     = txtCateAccess.Value.Remove(0, 3);
                    arrCate = txt.Split(sepparator);
                }
                _nhomnguoidungDAL.DeleteFromT_GroupCategory(Group_ID);
                _usermenuDAL.DeleteFromT_UserCategoryDynamic(" Ma_Nhom=" + Group_ID);
                string _sqldelete = string.Empty;
                for (int x = 0; x < arrCate.Length; x++)
                {
                    Cate_ID = Convert.ToInt32(arrCate[x].ToString());
                    _objcm  = _ChuyenmucDAL.GetOneFromT_ChuyenmucByID(Cate_ID);
                    if (_objcm.Ma_Chuyenmuc_Cha > 0)
                    {
                        _nhomnguoidungDAL.InsertT_GroupCategory(Cate_ID, Group_ID);
                        _sqldelete = "delete from T_Nhom_Chuyenmuc where Ma_Nhom=" + Group_ID + " and Ma_Chuyenmuc=" + _objcm.Ma_Chuyenmuc_Cha;
                        ulti.ExecSql(_sqldelete);
                        _nhomnguoidungDAL.InsertT_GroupCategory(_objcm.Ma_Chuyenmuc_Cha, Group_ID);
                    }
                    else
                    {
                        _nhomnguoidungDAL.InsertT_GroupCategory(Cate_ID, Group_ID);
                    }
                }
            }
            else
            {
                _usermenuDAL.DeleteFromT_UserCategoryDynamic(" Ma_Nhom=" + Group_ID);
                _nhomnguoidungDAL.DeleteFromT_GroupCategory(Group_ID);
            }
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty)
            {
                if (CommonLib.IsNumeric(Request["Menu_ID"]) == true)
                {
                    if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"])))
                    {
                        Response.Redirect("~/Errors/AccessDenied.aspx");
                    }
                    _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name);
                    if (!Page.IsPostBack)
                    {
                        int id = int.Parse(Page.Request.QueryString["ID"].ToString());

                        if (Page.Request.QueryString["Menu_ID"] != null)
                        {
                            T_Idiea      obj   = new T_Idiea();
                            T_IdieaDAL   dal   = new T_IdieaDAL();
                            ChuyenmucDAL caDal = new ChuyenmucDAL();
                            obj = dal.GetOneFromT_IdieaByID(id);
                            //add by Hung viet
                            if (obj.Cat_ID > 0)
                            {
                                this.litCatName.Text = caDal.GetOneFromT_ChuyenmucByID(int.Parse(obj.Cat_ID.ToString())).Ten_ChuyenMuc;
                            }
                            else
                            {
                                this.litCatName.Text = "";
                            }
                            this.litTittle.Text   = obj.Title.ToString();
                            this.litTacgia.Text   = UltilFunc.GetUserFullName(obj.User_Created);
                            this.litContent.Text  = CleanHTMLFont(obj.Comment.ToString());
                            this.lit_baiviet.Text = CleanHTMLFont(obj.Diea_Articles.ToString());
                            string count = this.litContent.Text + "" + this.lit_baiviet.Text;
                            this.LitCount.Text = UltilFunc.WordCount(count) + " từ ";
                            if (obj.Status == 6)
                            {
                                this.LitDatePublisher.Text = obj.Date_Duyet.ToString("dd/MM/yyyy HH:mm") + " (GMT + 7)";
                            }
                            ViewState["ver"] = -1;
                        }
                    }
                }
            }
        }
Esempio n. 8
0
        protected void dgData_EditCommand(object source, DataGridCommandEventArgs e)
        {
            double _ID = double.Parse(dgr_tintuc.DataKeys[e.Item.ItemIndex].ToString());

            if (e.CommandArgument.ToString().ToLower() == "edit")
            {
                PnlDetail.Visible   = true;
                PanelLisTin.Visible = false;
                ViewState["id"]     = _ID;
                T_TinBai obj = new T_TinBai();
                obj       = Daltinbai.load_T_news(_ID);
                Chuyenmuc = dalcm.GetOneFromT_ChuyenmucByID(obj.Ma_Chuyenmuc).Ten_ChuyenMuc;
                Tieude    = obj.Tieude.ToString();
                Noidung   = obj.Noidung.ToString();
                BindGridPhotosByMatin();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty)
            {
                if (CommonLib.IsNumeric(Request["Menu_ID"]) == true)
                {
                    if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"])))
                    {
                        Response.Redirect("~/Errors/AccessDenied.aspx");
                    }
                    _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name);
                    //btncopycontent1.Attributes.Add("onclick", "javascript:getvalue_exports()");
                    //btncopycontent2.Attributes.Add("onclick", "javascript:getvalue_exports()");
                    _ID = int.Parse(Page.Request.QueryString["ID"].ToString());


                    if (!IsPostBack)
                    {
                        if (_user == null)
                        {
                            Page.Response.Redirect("~/login.aspx", true);
                        }
                        else
                        {
                            T_TinBai obj = new T_TinBai();
                            obj       = Daltinbai.load_T_news(_ID);
                            Chuyenmuc = dalcm.GetOneFromT_ChuyenmucByID(obj.Ma_Chuyenmuc).Ten_ChuyenMuc;
                            Tieude    = obj.Tieude.ToString();
                            Noidung   = obj.Noidung.ToString();
                            BindGridPhotosByMatin();
                            if (DataListAnh.Items.Count != 0)
                            {
                                btn_downloadfile.Visible = true;
                            }
                            else
                            {
                                btn_downloadfile.Visible = false;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 10
0
        public override void DataBind()
        {
            T_Idiea        obj           = new T_Idiea();
            T_Allotments   _Allotment    = new T_Allotments();
            T_IdieaDAL     dal           = new T_IdieaDAL();
            T_AllotmentDAL _AllotmentDAL = new T_AllotmentDAL();
            ChuyenmucDAL   caDal         = new ChuyenmucDAL();

            if (Request["DT_id"] != null && Request["DT_id"].ToString() != "" && Request["DT_id"].ToString() != String.Empty)
            {
                int id = int.Parse(Page.Request["DT_id"].ToString());

                _Allotment = _AllotmentDAL.GetOneFromT_AllotmentByID(id);
                obj        = dal.GetOneFromT_IdieaByID(_Allotment.Idiea_ID);

                this.T_AllotmentNgayHT.Text = _Allotment.Date_End.ToString();
                this.ltrYeuCau.Text         = _Allotment.Request.ToString();
                if (obj.Cat_ID > 0)
                {
                    this.lblNameCM.Text = caDal.GetOneFromT_ChuyenmucByID(int.Parse(obj.Cat_ID.ToString())).Ten_ChuyenMuc;
                }
                if (obj.Title.ToString().Length > 0)
                {
                    this.lbtieude.Text = obj.Title.ToString();
                }

                if (_Allotment.Type == 1)
                {
                    ltr_loaibai1.Text = "Bài viết";
                }
                else
                {
                    ltr_loaibai1.Text = "Bài ảnh";
                }

                MaCM = obj.Cat_ID;
            }
        }
Esempio n. 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name);
     if (_user != null)
     {
         if (!Page.IsPostBack)
         {
             int          id    = int.Parse(Page.Request.QueryString["ID"].ToString());
             T_News       obj   = new T_News();
             T_NewsDAL    dal   = new T_NewsDAL();
             ChuyenmucDAL caDal = new ChuyenmucDAL();
             obj = dal.load_T_news(id);
             if (obj.CAT_ID > 0)
             {
                 this.litCatName.Text = caDal.GetOneFromT_ChuyenmucByID(int.Parse(obj.CAT_ID.ToString())).Ten_ChuyenMuc;
             }
             else
             {
                 this.litCatName.Text = "";
             }
             this.litDanNhap.Text = obj.News_Sub_Title.ToString();
             this.litTittle.Text  = obj.News_Tittle.ToString();
             this.LitSummery.Text = CleanHTMLFont(CleanHTMLSummary(obj.News_Summary.ToString()));
             this.litContent.Text = CleanHTMLFont(obj.News_Body.ToString());
             if (obj.News_Status == 6)
             {
                 this.LitDatePublisher.Text = obj.News_DateEdit.ToString("dd/MM/yyyy HH:mm") + " (GMT + 7)";
             }
             string count = this.litContent.Text;
             this.LitCount.Text = UltilFunc.WordCount(count) + " từ ";
         }
     }
     else
     {
         Response.Redirect("~/Errors/AccessDenied.aspx");
     }
 }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty)
            {
                if (CommonLib.IsNumeric(Request["Menu_ID"]) == true)
                {
                    if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"])))
                    {
                        Response.Redirect("~/Errors/AccessDenied.aspx");
                    }
                    _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name);
                    if (!Page.IsPostBack)
                    {
                        int id = int.Parse(Page.Request.QueryString["ID"].ToString());

                        if (Page.Request.QueryString["Menu_ID"] != null)
                        {
                            T_Idiea        obj   = new T_Idiea();
                            T_IdieaVersion _obj2 = new T_IdieaVersion();
                            T_IdieaDAL     dal   = new T_IdieaDAL();
                            ChuyenmucDAL   caDal = new ChuyenmucDAL();
                            obj = dal.GetOneFromT_IdieaByID(id);

                            //add by nvthai
                            T_IdieaVersion _objVer = new T_IdieaVersion();
                            if (obj.Diea_Stype == 1)
                            {
                                _objVer = dal.GetOneFromT_IdieaVersionByIDVersion(id, 4, 54);
                                _obj2   = dal.GetOneFromT_IdieaVersionByIDVersion(id, 1, 62);
                            }
                            else
                            {
                                _objVer = dal.GetOneFromT_IdieaVersionByIDVersion(id, 4, 54);
                                _obj2   = dal.GetOneFromT_IdieaVersionByIDVersion(id, 3, 23);
                            }


                            //add by Hung viet
                            if (obj.Cat_ID > 0)
                            {
                                this.litCatName.Text = caDal.GetOneFromT_ChuyenmucByID(int.Parse(_obj2.Cat_ID.ToString())).Ten_ChuyenMuc;
                                this.litCM.Text      = caDal.GetOneFromT_ChuyenmucByID(int.Parse(_objVer.Cat_ID.ToString())).Ten_ChuyenMuc;
                            }
                            else
                            {
                                this.litCatName.Text = "";
                                this.litCM.Text      = "";
                            }
                            this.litTittle.Text   = _obj2.Title.ToString();
                            this.litTacgia.Text   = UltilFunc.GetUserFullName(_obj2.User_Created);
                            this.litContent.Text  = CleanHTMLFont(_obj2.Comment.ToString());
                            this.lit_baiviet.Text = CleanHTMLFont(_obj2.Diea_Articles.ToString());
                            string coutstring = this.litContent.Text + " " + this.lit_baiviet.Text;
                            this.litCounter.Text = UltilFunc.WordCount(coutstring).ToString() + " từ";

                            this.litTenDetai.Text    = _objVer.Title.ToString();
                            this.literNguoiviet.Text = UltilFunc.GetUserFullName(_objVer.User_Edit);
                            this.litContents.Text    = CleanHTMLFont(_objVer.Comment.ToString());
                            this.litbai.Text         = CleanHTMLFont(_objVer.Diea_Articles.ToString());
                            string coutstring2 = this.litContents.Text + " " + this.litbai.Text;
                            this.litCouter2.Text = UltilFunc.WordCount(coutstring2).ToString() + " từ";
                            ViewState["ver"]     = -1;
                        }
                    }
                }
            }
        }
Esempio n. 13
0
 protected void dgCategorysCopy_EditCommand(object source, DataGridCommandEventArgs e)
 {
     if (e.CommandArgument.ToString().ToLower() == "editcopy")
     {
         HPCBusinessLogic.DAL.T_NewsDAL _NewsDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
         HPCBusinessLogic.ChuyenmucDAL  _catDAL  = new ChuyenmucDAL();
         DataGridItem m_Item      = e.Item;
         int          CatalogID   = int.Parse(dgCategorysCopy.DataKeys[m_Item.ItemIndex].ToString());
         double       _IDNewsCopy = _NewsDAL.Copy_To_Categorys(NewsID, CatalogID, 6, DateTime.Now, _user.UserID, _user.UserID, _user.UserName);
         if (_IDNewsCopy > 0)
         {
             WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Copy]", Request["Menu_ID"], "[Copy] [Bài đã xuất bản]: [Tin bài đã xuất bản] [Thao tác copy bài vào chuyên mục: " + _catDAL.GetOneFromT_ChuyenmucByID(CatalogID).Ten_ChuyenMuc + "]", _IDNewsCopy, ConstAction.BaoDT);
         }
         CheckBox    checkcopy = (CheckBox)m_Item.FindControl("optSelect");
         ImageButton btnCopy   = (ImageButton)m_Item.FindControl("btnCopy");
         btnCopy.Visible   = false;
         checkcopy.Visible = false;
         checkcopy.Enabled = false;
         this.LoadData_DangXuly();
     }
 }
Esempio n. 14
0
 protected void but_XB_Click(object sender, EventArgs e)
 {
     HPCBusinessLogic.DAL.T_NewsDAL _NewsDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
     HPCBusinessLogic.ChuyenmucDAL  _catDAL  = new ChuyenmucDAL();
     foreach (DataGridItem m_Item in dgCategorysCopy.Items)
     {
         CheckBox checkcopy = (CheckBox)m_Item.FindControl("optSelect");
         if (checkcopy != null && checkcopy.Checked && checkcopy.Enabled)
         {
             int    CatalogID   = int.Parse(dgCategorysCopy.DataKeys[m_Item.ItemIndex].ToString());
             double _IDNewsCopy = _NewsDAL.Copy_To_Categorys(NewsID, CatalogID, 6, DateTime.Now, _user.UserID, _user.UserID, _user.UserName);
             if (_IDNewsCopy > 0)
             {
                 WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Copy]", Request["Menu_ID"], "[Copy] [Bài đã xuất bản]: [Tin bài đã xuất bản] [Thao tác copy bài vào chuyên mục: " + _catDAL.GetOneFromT_ChuyenmucByID(CatalogID).Ten_ChuyenMuc + "]", _IDNewsCopy, ConstAction.TSAnh);
             }
         }
     }
     ModalPopupExtender1.Hide();
     this.LoadData_DangXuly();
     //Tao cache
     //UltilFunc.GenCacheHTML();
     System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Xuất bản ra chuyên mục khác thành công !');", true);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = int.Parse(Page.Request.QueryString["ID"].ToString());

            if (Page.Request.QueryString["Menu_ID"] != null)
            {
                if (!IsPostBack)
                {
                    T_TinBai obj = new T_TinBai();
                    obj    = Daltinbai.load_T_news(id);
                    Tieude = obj.Tieude;
                    if (obj.Sotu != 0)
                    {
                        Sotu = obj.Sotu.ToString();
                    }
                    else
                    {
                        Sotu = "0";
                    }
                    if (obj.Tiennhuanbut > 0)
                    {
                        Nhuanbut = String.Format("{0:00,0}", Convert.ToDecimal(obj.Tiennhuanbut.ToString()));
                    }
                    else
                    {
                        Nhuanbut = String.Format("{0:00,0}", "0");
                    }
                    //string sqltien = "select Sotien,Ma_tacgia from T_NhuanBut where Ma_tacgia<>" + obj.Ma_TacGia + " and Ma_TinBai=" + id;
                    //DataTable dtnhuanbut = _ulti.ExecSqlDataSet(sqltien).Tables[0];
                    //if (dtnhuanbut != null && dtnhuanbut.Rows.Count > 0)
                    //{
                    //    for (int i = 0; i < dtnhuanbut.Rows.Count; i++)
                    //    {
                    //        if (i == 0)
                    //            Nhuanbut += "; " + String.Format("{0:00,0}", Convert.ToDecimal(dtnhuanbut.Rows[i]["Sotien"].ToString())) + "; ";
                    //        else
                    //            Nhuanbut += String.Format("{0:00,0}", Convert.ToDecimal(dtnhuanbut.Rows[i]["Sotien"].ToString())) + "; ";
                    //    }
                    //}


                    if (dalcm.GetOneFromT_ChuyenmucByID(obj.Ma_Chuyenmuc) != null)
                    {
                        Chuyenmuc = dalcm.GetOneFromT_ChuyenmucByID(obj.Ma_Chuyenmuc).Ten_ChuyenMuc;
                    }
                    else
                    {
                        Chuyenmuc = "";
                    }
                    Tieude  = obj.Tieude.ToString();
                    Noidung = obj.Noidung.ToString();
                    Ghichu  = obj.GhiChu;
                    Tacgia  = obj.TacGia;

                    DataTable dttrangbaosobao = UltilFunc.GetTrangSoBaoFrom_T_VitriTiBai(id);
                    if (dttrangbaosobao != null && dttrangbaosobao.Rows.Count > 0)
                    {
                        Sotrang = " Trang: " + dttrangbaosobao.Rows[0]["Trang"].ToString();
                    }
                    else
                    {
                        Sotrang = "";
                    }

                    if (_NguoidungDAL.GetUserByUserName_ID((int)obj.Ma_Nguoitao) != null)
                    {
                        nguoisua = _NguoidungDAL.GetUserByUserName_ID((int)obj.Ma_Nguoitao).UserFullName;
                    }
                    else
                    {
                        nguoisua = "User does not exist";
                    }
                    DataTable dtphienban = Daltinbai.GetOneFromT_PhienbanByNews_ID(id, -1, false).Tables[0];
                    if (dtphienban != null && dtphienban.Rows.Count > 0)
                    {
                        ViewState["ver"] = dtphienban.Rows[0]["Ma_Phienban"].ToString();
                    }
                    else
                    {
                        ViewState["ver"] = -1;
                    }
                    LoadDataImageTinBai(id.ToString());
                    BindGrid();
                }
            }
        }
Esempio n. 16
0
        public static void Backup_fileDoc(double NewsID, string _UserName, string _Chucnang)
        {
            string       _noidung    = string.Empty;
            string       _tieude     = string.Empty;
            string       _loaibao    = string.Empty;
            string       _sobao      = string.Empty;
            int          _lb         = 0;
            int          _sb         = 0;
            string       strFileName = string.Empty;
            string       strHTML     = string.Empty;
            AnPhamDAL    _dalanpham  = new AnPhamDAL();
            ChuyenmucDAL dalcm       = new ChuyenmucDAL();
            SobaoDAL     dalsb       = new SobaoDAL();

            HPCBusinessLogic.DAL.TinBaiDAL dalnews = new HPCBusinessLogic.DAL.TinBaiDAL();
            _tieude  += dalnews.load_T_news(NewsID).Tieude;
            _tieude  += System.Environment.NewLine;
            _noidung += dalnews.load_T_news(NewsID).Noidung;
            _noidung += System.Environment.NewLine;
            if (dalnews.load_T_news(NewsID).Ma_NgonNgu != 0)
            {
                _lb       = dalnews.load_T_news(NewsID).Ma_Anpham;
                _loaibao += _dalanpham.GetOneFromT_AnPhamByID(_lb).Ten_AnPham;
            }
            if (dalnews.load_T_news(NewsID).Ma_Chuyenmuc != 0)
            {
                _lb       = dalnews.load_T_news(NewsID).Ma_Chuyenmuc;
                _loaibao += _dalanpham.GetOneFromT_AnPhamByID(dalcm.GetOneFromT_ChuyenmucByID(_lb).Ma_AnPham).Ten_AnPham;
            }
            if (dalnews.load_T_news(NewsID).Ma_Sobao != 0)
            {
                _sb     = dalnews.load_T_news(NewsID).Ma_Sobao;
                _sobao += dalsb.GetOneFromT_SobaoByID(_sb).Ten_Sobao;
            }

            if (_noidung.Length > 0)
            {
                strHTML += "<html><BODY>";
                strHTML += _tieude;
                strHTML += "<br />";
                strHTML += "<br />";
                strHTML += _noidung;
                strHTML += "</BODY></html>";
                DirectoryInfo r = new DirectoryInfo(HttpContext.Current.Server.MapPath("~" + System.Configuration.ConfigurationManager.AppSettings["BackupDoc"].ToString()));
                if (File.Exists(r.ToString()))
                {
                    FileInfo[] file;

                    file = r.GetFiles("*.doc");

                    foreach (FileInfo i in file)
                    {
                        File.Delete(r.FullName + "\\" + i.Name);
                    }
                }
                strFileName = _UserName + _Chucnang + "_" + string.Format("{0:dd-MM-yyyy_hh-mm-ss}", System.DateTime.Now);
                string pathStore = HttpContext.Current.Server.MapPath("~" + System.Configuration.ConfigurationManager.AppSettings["BackupDoc"].ToString() + _Chucnang + "/" + _loaibao + "/" + _sobao + "/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day);
                string path      = HttpContext.Current.Server.MapPath("~" + System.Configuration.ConfigurationManager.AppSettings["BackupDoc"].ToString() + _Chucnang + "/" + _loaibao + "/" + _sobao + "/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/" + strFileName + ".doc");
                if (!File.Exists(pathStore))
                {
                    Directory.CreateDirectory(pathStore);
                }
                try
                {
                    StreamWriter wr = new StreamWriter(path, false, System.Text.Encoding.Unicode);
                    wr.Write(strHTML);
                    wr.Close();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }