Exemplo n.º 1
0
        public static string GetStatusUpdateContents(Object ID)
        {
            HPCInfo.T_TinBai _obj = new T_TinBai();
            HPCBusinessLogic.DAL.TinBaiDAL _daltinbai = new HPCBusinessLogic.DAL.TinBaiDAL();
            string str = "";

            try
            {
                if (ID != DBNull.Value)
                {
                    _obj = _daltinbai.load_T_news(double.Parse(ID.ToString()));
                    if (_obj.UpdateContents == 0)
                    {
                        str = _obj.Tieude;
                    }
                    else
                    {
                        str = "<span style=\"font-family: arial; font-size: 14px; color: red; font-weight: bold;font-style: italic\">Tin mới</span></br>" + _obj.Tieude;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(str);
        }
Exemplo n.º 2
0
        public static string GetTieuDeBaiGac(Object ID)
        {
            UltilFunc ulti       = new UltilFunc();
            string    _Trangthai = string.Empty;
            string    _tieudetin = string.Empty;

            HPCBusinessLogic.DAL.TinBaiDAL _daltinbai = new HPCBusinessLogic.DAL.TinBaiDAL();
            string str = "";

            try
            {
                if (ID != DBNull.Value)
                {
                    _tieudetin = _daltinbai.load_T_news(double.Parse(ID.ToString())).Tieude;
                    _Trangthai = UltilFunc.GetColumnValuesOne("T_PhienBan", "Trangthai", "Trangthai=5 and Ma_Tinbai=" + ID.ToString()).ToString();
                    if (_Trangthai == "0")
                    {
                        str = _tieudetin;
                    }
                    else
                    {
                        str = "<img  border=0 height='12px' src='" + Global.ApplicationPath + "/Dungchung/Images/baigac.gif' alt='Bài gác' title=' Bài gác'> <br/>" + _tieudetin;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(str);
        }
        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;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 4
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;
                }
            }
        }