Exemple #1
0
        protected string TenAnpham(Object _maAnpham)
        {
            string    strReturn  = "";
            AnPhamDAL _anphamDAL = new AnPhamDAL();

            if (_maAnpham != DBNull.Value)
            {
                if (_anphamDAL.GetOneFromT_AnPhamByID(Convert.ToInt32(_maAnpham)) != null)
                {
                    strReturn = _anphamDAL.GetOneFromT_AnPhamByID(Convert.ToInt32(_maAnpham)).Ten_AnPham;
                }
            }

            return(strReturn);
        }
        public TrangDetails[] BindDatatoDropdownTrang(object AnphamID)
        {
            List <TrangDetails> _Trangdetails = new List <TrangDetails>();

            HPCBusinessLogic.AnPhamDAL dal = new AnPhamDAL();

            try
            {
                if (int.Parse(AnphamID.ToString()) > 0)
                {
                    int _sotrang = int.Parse(dal.GetOneFromT_AnPhamByID(int.Parse(AnphamID.ToString())).Sotrang.ToString());

                    for (int j = 1; j < _sotrang + 1; j++)
                    {
                        TrangDetails _Trang = new TrangDetails();
                        _Trang.ID   = Convert.ToInt32(j.ToString());
                        _Trang.Name = "Page " + j.ToString();
                        _Trangdetails.Add(_Trang);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(_Trangdetails.ToArray());
        }
Exemple #3
0
        private void GenerateRTFFile(string _Noidung, string _tieude, double id)
        {
            string strFileName;
            string strHTML = "";

            strHTML += "<html>";
            strHTML += "<BODY>";
            strHTML += ConvertUnicode2Vni(_Noidung);
            strHTML += "</BODY></html>";
            int _lb = 0;

            HPCBusinessLogic.AnPhamDAL dalanpham = new AnPhamDAL();
            HPCBusinessLogic.SobaoDAL  dalsb     = new SobaoDAL();
            string _loaibao = string.Empty;
            string _sobao   = string.Empty;
            string _Trang   = string.Empty;


            DataTable dttrangsb = UltilFunc.GetTrangSoBaoFrom_T_VitriTiBai(int.Parse(id.ToString()));

            _lb      = Daltinbai.load_T_news(id).Ma_Anpham;
            _loaibao = dalanpham.GetOneFromT_AnPhamByID(_lb).Ten_AnPham.ToString();
            if (dttrangsb.Rows.Count > 0)
            {
                _sobao += dalsb.GetOneFromT_SobaoByID(int.Parse(dttrangsb.Rows[0]["Ma_Sobao"].ToString())).Ten_Sobao;
                _Trang += dttrangsb.Rows[0]["Trang"].ToString();
            }

            string Pathfolder   = System.Configuration.ConfigurationManager.AppSettings["DanTrang"].ToString() + _loaibao + "/" + _sobao + "/" + _Trang;
            string Pathphysical = Context.Server.MapPath("/" + Pathfolder);

            if (!File.Exists(Pathphysical))
            {
                Directory.CreateDirectory(Pathphysical);
            }
            strFileName = CommonLib.ReplaceCharsRewrite(_tieude) + ".rtf";
            string savepath = Pathphysical + "/" + strFileName;

            try
            {
                StreamWriter wr = new StreamWriter(savepath, false, System.Text.Encoding.Unicode);
                wr.Write(strHTML);
                wr.Close();
                CreateWordFile(savepath);
                getListImage(id, _tieude);
                ListNewsDownload _item = new ListNewsDownload();
                _item.Tieude      = CommonLib.ReplaceCharsRewrite(_tieude);
                _item.Duongdananh = savepath;
                listPathFile.Add(_item);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #4
0
        private void GetItem(int _id)
        {
            T_AnPham  _objAnPham = new T_AnPham();
            AnPhamDAL _anphamDAL = new AnPhamDAL();

            _objAnPham = _anphamDAL.GetOneFromT_AnPhamByID(_id);
            this.txt_TenAnPham.Text = _objAnPham.Ten_AnPham;
            this.txt_Mota.Text      = _objAnPham.Mota;
            this.txt_Sotrang.Text   = _objAnPham.Sotrang.ToString();
            this.txtThumbnail.Text  = _objAnPham.Url_Img;
        }
Exemple #5
0
        protected string TenAnpham(string _maAnpham)
        {
            string    strReturn = "";
            T_AnPham  _anpham;
            AnPhamDAL _anphamDAL = new AnPhamDAL();

            _anpham = _anphamDAL.GetOneFromT_AnPhamByID(Convert.ToInt32(_maAnpham));
            if (_anpham != null)
            {
                strReturn = _anpham.Ten_AnPham;
            }
            return(strReturn);
        }
 private void bintrang(int _loaibao)
 {
     HPCBusinessLogic.AnPhamDAL dal = new AnPhamDAL();
     cboPage.Items.Clear();
     if (_loaibao > 0)
     {
         int _sotrang = int.Parse(dal.GetOneFromT_AnPhamByID(_loaibao).Sotrang.ToString());
         cboPage.Items.Add(new ListItem((string)HttpContext.GetGlobalResourceObject("cms.language", "lblChontrang"), "0", true));
         for (int j = 1; j < _sotrang + 1; j++)
         {
             cboPage.Items.Add(new ListItem((string)HttpContext.GetGlobalResourceObject("cms.language", "lblTrang") + j.ToString(), j.ToString()));
         }
     }
 }
 private void bintrang(int _loaibao)
 {
     HPCBusinessLogic.AnPhamDAL dal = new AnPhamDAL();
     cbo_trang.Items.Clear();
     cbo_trang.Items.Add("----Chọn trang----");
     if (_loaibao > 0)
     {
         int _sotrang = int.Parse(dal.GetOneFromT_AnPhamByID(_loaibao).Sotrang.ToString());
         for (int i = 1; i < _sotrang + 1; i++)
         {
             cbo_trang.Items.Add(new ListItem("Trang " + i.ToString(), i.ToString()));
         }
     }
 }
Exemple #8
0
        private void Backup_fileRTF(string _noidung, string _tieude)
        {
            string strFileName;
            string strHTML = "";

            strHTML += "<html><BODY>";
            strHTML += "<br>";
            strHTML += "<br>";
            strHTML += _noidung;
            strHTML += "</BODY></html>";
            int _lb = 0;

            HPCBusinessLogic.AnPhamDAL dalanpham = new AnPhamDAL();
            HPCBusinessLogic.SobaoDAL  dalsb     = new SobaoDAL();
            string _loaibao = string.Empty;
            string _Trang   = string.Empty;

            T_QuangCao _obj = new T_QuangCao();

            _obj     = _DalQC.GetOneFromT_QuangCaoByID(id);
            _lb      = _obj.Ma_Loaibao;
            _loaibao = dalanpham.GetOneFromT_AnPhamByID(_lb).Ten_AnPham.ToString();
            if (_obj.Trang > 0)
            {
                _Trang = _obj.Trang.ToString();
            }

            string pathfolder   = System.Configuration.ConfigurationManager.AppSettings["DanTrang"].ToString() + _loaibao + "/" + _Trang;
            string pathphysical = Context.Server.MapPath("/" + pathfolder);

            if (!File.Exists(pathphysical))
            {
                Directory.CreateDirectory(pathphysical);
            }
            strFileName = "Quangcao_" + _loaibao + "_Trang_" + _Trang + "_" + CommonLib.ReplaceCharsRewrite(_tieude) + ".rtf";
            string savepath = pathphysical + "/" + strFileName;

            try
            {
                StreamWriter wr = new StreamWriter(savepath, false, System.Text.Encoding.Unicode);
                wr.Write(strHTML);
                wr.Close();
                CreateWordFile(savepath);
                Page.Response.Redirect(pathfolder + "/" + strFileName);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #9
0
        protected string TenAnpham(string _maAnpham)
        {
            string strReturn = "";

            if (!String.IsNullOrEmpty(_maAnpham) && Convert.ToInt32(_maAnpham) > 0)
            {
                T_AnPham  _anpham;
                AnPhamDAL _anphamDAL = new AnPhamDAL();
                _anpham   = _anphamDAL.GetOneFromT_AnPhamByID(Convert.ToInt32(_maAnpham));
                strReturn = _anpham.Ten_AnPham;
            }
            else
            {
                strReturn = "";
            }
            return(strReturn);
        }
Exemple #10
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;
                }
            }
        }