Example #1
0
        private void PopulateItem(int _id)
        {
            T_QuangCao _objqc = new T_QuangCao();

            HPCBusinessLogic.DAL.QuangCaoDAL _QCDAL = new HPCBusinessLogic.DAL.QuangCaoDAL();
            _objqc = _QCDAL.GetOneFromT_QuangCaoByID(_id);
            txt_tenquangcao.Text       = _objqc.Ten_QuangCao;
            ckeNoidung.Text            = _objqc.Noidung;
            cboKhachhang.SelectedIndex = CommonLib.GetIndexControl(cboKhachhang, _objqc.Ma_KhachHang.ToString());
            cbokichthuoc.SelectedIndex = CommonLib.GetIndexControl(cbokichthuoc, _objqc.Kichthuoc.ToString());
            cboAnPham.SelectedIndex    = CommonLib.GetIndexControl(cboAnPham, _objqc.Ma_Loaibao.ToString());

            bintrang(int.Parse(cboAnPham.SelectedValue.ToString()));
            if (_objqc.Trang != 0)
            {
                string _sotrang = _objqc.Trang.ToString();
                cboTrang.SelectedIndex = int.Parse(_sotrang);
            }
            else
            {
                cboTrang.SelectedIndex = 0;
            }

            txtNgaybatdau.Text = _objqc.Ngaydang.ToString("dd/MM/yyyy");
            LoadDataImage();
            ListNgaydangQC();
        }
Example #2
0
        private T_QuangCao SetItem(int _status)
        {
            T_QuangCao _obj = new T_QuangCao();

            if (Page.Request.Params["id"] != null)
            {
                _obj.Ma_Quangcao = int.Parse(Page.Request["id"].ToString());
            }
            else
            {
                _obj.Ma_Quangcao = 0;
            }
            _obj.Ten_QuangCao = txt_tenquangcao.Text.Trim();
            _obj.Noidung      = ckeNoidung.Text.Trim();
            _obj.Trang        = int.Parse(cboTrang.SelectedValue.ToString());
            _obj.Kichthuoc    = int.Parse(cbokichthuoc.SelectedValue);
            _obj.Ma_KhachHang = int.Parse(cboKhachhang.SelectedValue.ToString());
            _obj.Ma_Loaibao   = int.Parse(cboAnPham.SelectedValue.ToString());
            _obj.Ngaydang     = UltilFunc.ToDate(txtNgaybatdau.Text.Trim(), "dd/MM/yyyy");
            _obj.NgayTao      = DateTime.Now;
            _obj.Nguoitao     = _user.UserID;
            _obj.Trangthai    = _status;

            return(_obj);
        }
Example #3
0
 protected void LinkButtonBack_Click(object sender, EventArgs e)
 {
     if (!_isRefresh)
     {
         obj             = SetItem(23);
         obj.Ma_Quangcao = dal.InsertT_QuangCao(obj);
         dal.Sp_InsertT_PhienBanQuangCao(obj.Ma_Quangcao);
         string Thaotac = "Gửi trả lại quảng cáo từ TBT.QC về TP-QC ID: " + obj.Ma_Quangcao.ToString();
         UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), Thaotac);
         Page.Response.Redirect("~/Quangcao/List_TTQC.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&Tab=" + Request["Tab"].ToString());
     }
 }
Example #4
0
 protected void linkSend_Click(object sender, EventArgs e)
 {
     if (!_isRefresh)
     {
         obj             = SetItem(51);
         obj.Ma_Quangcao = dal.InsertT_QuangCao(obj);
         dal.Sp_InsertT_PhienBanQuangCao(obj.Ma_Quangcao);
         SaveImagesAttachAll(obj.Ma_Quangcao);
         SaveNgaydangQC(obj.Ma_Quangcao);
         string Thaotac = "Gửi quảng cáo từ TBT-QC đến TLBT-QC ID: " + obj.Ma_Quangcao.ToString();
         UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), Thaotac);
         Page.Response.Redirect("~/Quangcao/List_TTQC.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&Tab=" + Request["Tab"].ToString());
     }
 }
Example #5
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;
            }
        }
 protected void linkSave_Click(object sender, EventArgs e)
 {
     if (!_isRefresh)
     {
         string Thaotac = "";
         obj = SetItem(12);
         double _return = dal.InsertT_QuangCao(obj);
         SaveNgaydangQC(_return);
         SaveImagesAttachAll(_return);
         if (Request["ID"] != null)
         {
             Thaotac = "Sửa thông tin quảng cáo ID: " + Request["ID"].ToString();
         }
         else
         {
             Thaotac = "Thêm mới thông tin quảng cáo ID: " + _return.ToString();
         }
         UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), Thaotac);
         Page.Response.Redirect("~/Quangcao/Edit_QuangCao.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&ID=" + _return + "&Tab=" + Request["Tab"].ToString());
     }
 }
Example #7
0
 protected void LinkButtonBack_Click(object sender, EventArgs e)
 {
     if (!_isRefresh)
     {
         int Nguoitao = 0;
         Nguoitao = UltilFunc.GetColumnValuesOne("T_PhienBanQuangCao", "Nguoitao", " Ma_Quangcao=" + Request["ID"].ToString() + " and Trangthai=21");
         if (Nguoitao != 0)
         {
             obj             = SetItem(13);
             obj.Ma_Quangcao = dal.InsertT_QuangCao(obj);
             dal.Sp_UpdateRowT_QuangCao(obj.Ma_Quangcao, Nguoitao, 13);
             dal.Sp_InsertT_PhienBanQuangCao(obj.Ma_Quangcao);
             string Thaotac = "Gửi trả lại quảng cáo từ TP.QC về NV-QC ID: " + obj.Ma_Quangcao.ToString();
             UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), Thaotac);
             Page.Response.Redirect("~/Quangcao/List_TPQC.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&Tab=" + Request["Tab"].ToString());
         }
         else
         {
             FuncAlert.AlertJS(this, "không thể trả lại vì QC không phải của NVQC");
             return;
         }
     }
 }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id = int.Parse(Page.Request.QueryString["ID"].ToString());
            btncopycontent1.Attributes.Add("onclick", "javascript:getvalue_exports()");
            btncopycontent2.Attributes.Add("onclick", "javascript:getvalue_exports()");
            if (Page.Request.QueryString["Menu_ID"] != null)
            {
                if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"])))
                {
                    Response.Redirect("~/Errors/AccessDenied.aspx");
                }
                _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name);
                if (!IsPostBack)
                {
                    T_QuangCao obj = new T_QuangCao();
                    obj = _DalQC.GetOneFromT_QuangCaoByID(id);

                    Tenquangcao = obj.Ten_QuangCao.ToString();
                    Noidung     = obj.Noidung.ToString();
                    Kichthuoc   = UltilFunc.GetKichCoQuangCao(obj.Kichthuoc);
                    Loaibao     = UltilFunc.GetTenAnpham(obj.Ma_Loaibao);
                    Ngaydang    = obj.Ngaydang.ToString("dd/MM/yyyy");

                    if (obj.Trang > 0)
                    {
                        Sotrang = " Trang :" + obj.Trang.ToString();
                    }
                    else
                    {
                        Sotrang = "";
                    }

                    _MaNguoinhap = int.Parse(_ulti.GetColumnValuesDynamic("T_PhienBanQuangCao", " top 1 Nguoitao", "Nguoitao", "Ma_Quangcao=" + id + " order by ID ASC"));
                    if (_MaNguoinhap != 0)
                    {
                        if (_NguoidungDAL.GetUserByUserName_ID(_MaNguoinhap) != null)
                        {
                            Nguoinhap = _NguoidungDAL.GetUserByUserName_ID(_MaNguoinhap).UserFullName;
                        }
                        else
                        {
                            Nguoinhap = "";
                        }
                    }
                    else
                    {
                        Nguoinhap = "";
                    }
                    if (_NguoidungDAL.GetUserByUserName_ID((int)obj.Nguoitao) != null)
                    {
                        nguoisua = _NguoidungDAL.GetUserByUserName_ID((int)obj.Nguoitao).UserFullName;
                    }
                    else
                    {
                        nguoisua = "User does not exist";
                    }

                    _MaPhienbanQC = int.Parse(_ulti.GetColumnValuesDynamic("T_PhienBanQuangCao", " top 1 ID", "ID", "Ma_Quangcao=" + id + " order by ID DESC"));

                    if (_MaPhienbanQC != 0)
                    {
                        ViewState["ver"] = _MaPhienbanQC.ToString();
                    }
                    else
                    {
                        ViewState["ver"] = -1;
                    }
                    LoadDataImageTinBai();
                }
            }
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id = int.Parse(Page.Request.QueryString["ID"].ToString());
            if (Page.Request.QueryString["Menu_ID"] != null)
            {
                if (!IsPostBack)
                {
                    T_QuangCao obj = new T_QuangCao();
                    obj = _DalQC.GetOneFromT_QuangCaoByID(id);

                    Tenquangcao = obj.Ten_QuangCao.ToString();
                    Noidung     = obj.Noidung.ToString();
                    Kichthuoc   = UltilFunc.GetKichCoQuangCao(obj.Kichthuoc);
                    Loaibao     = UltilFunc.GetTenAnpham(obj.Ma_Loaibao);
                    Ngaydang    = obj.Ngaydang.ToString("dd/MM/yyyy");

                    if (obj.Trang > 0)
                    {
                        Sotrang = " Trang :" + obj.Trang.ToString();
                    }
                    else
                    {
                        Sotrang = "";
                    }

                    _MaNguoinhap = int.Parse(_ulti.GetColumnValuesDynamic("T_PhienBanQuangCao", " top 1 Nguoitao", "Nguoitao", "Ma_Quangcao=" + id + " order by ID ASC"));
                    if (_MaNguoinhap != 0)
                    {
                        if (_NguoidungDAL.GetUserByUserName_ID(_MaNguoinhap) != null)
                        {
                            Nguoinhap = _NguoidungDAL.GetUserByUserName_ID(_MaNguoinhap).UserFullName;
                        }
                        else
                        {
                            Nguoinhap = "";
                        }
                    }
                    else
                    {
                        Nguoinhap = "";
                    }
                    if (_NguoidungDAL.GetUserByUserName_ID((int)obj.Nguoitao) != null)
                    {
                        nguoisua = _NguoidungDAL.GetUserByUserName_ID((int)obj.Nguoitao).UserFullName;
                    }
                    else
                    {
                        nguoisua = "User does not exist";
                    }

                    _MaPhienbanQC = int.Parse(_ulti.GetColumnValuesDynamic("T_PhienBanQuangCao", " top 1 ID", "ID", "Ma_Quangcao=" + id + " order by ID DESC"));

                    if (_MaPhienbanQC != 0)
                    {
                        ViewState["ver"] = _MaPhienbanQC.ToString();
                    }
                    else
                    {
                        ViewState["ver"] = -1;
                    }
                    LoadDataImageTinBai(id.ToString());
                    BindGridNguoiXuly();
                }
            }
        }
Example #10
0
 public int InsertT_QuangCao(T_QuangCao obj)
 {
     return(HPCDataProvider.Instance().InsertObjectReturn(obj, "Sp_InsertT_QuangCao"));
 }