Beispiel #1
0
 protected void GVAnPhamLayout_OnRowCommand(object sender, GridViewCommandEventArgs 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
     if (e.CommandName.Equals("AddNew"))
     {
         TextBox             _trang      = (TextBox)GVAnPhamLayout.FooterRow.FindControl("txt_Trang");
         DropDownList        _ddl_Layout = (DropDownList)GVAnPhamLayout.FooterRow.FindControl("ddl_Layout");
         int                 _return;
         AnPhamMau_LayoutDAL _apDAL = new AnPhamMau_LayoutDAL();
         T_AnPhamMau_Layout  _obj   = new T_AnPhamMau_Layout();
         _obj.ID     = 0;
         _obj.Ma_Mau = EID;
         if ((!String.IsNullOrEmpty(_trang.Text.Trim())) && (Convert.ToInt32(_ddl_Layout.SelectedValue.ToString()) > 0))
         {
             _obj.Trang     = Convert.ToInt32(_trang.Text.Trim());
             _obj.Ma_layout = Convert.ToInt32(_ddl_Layout.SelectedValue.ToString());
             _return        = _apDAL.InsertT_Anphammau_Layout(_obj);
             action.Thaotac = "[Thêm mới ấn phẩm mẫu - layout]-->[Mã ấn phẩm mẫu - layout:" + _return.ToString() + " ]";
             actionDAL.InserT_Lichsu_Thaotac_Hethong(action);
         }
         Bind_AnphamMau_Layout();
     }
 }
Beispiel #2
0
        protected void GVAnPhamLayout_RowUpdating(object sender, GridViewUpdateEventArgs 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
            int _return;
            int _id = Convert.ToInt32(GVAnPhamLayout.DataKeys[e.RowIndex].Value.ToString());

            //TextBox _trang = (TextBox)GVAnPhamLayout.Rows[e.RowIndex].FindControl("txt_Trang");
            Label        _trang     = (Label)GVAnPhamLayout.Rows[e.RowIndex].FindControl("lblMota");
            DropDownList _ddlLayout = (DropDownList)GVAnPhamLayout.Rows[e.RowIndex].FindControl("ddl_Layout");

            AnPhamMau_LayoutDAL _apDAL = new AnPhamMau_LayoutDAL();
            T_AnPhamMau_Layout  _ap    = new T_AnPhamMau_Layout();
            _ap.ID     = _id;
            _ap.Ma_Mau = EID;

            if (Convert.ToInt32(_ddlLayout.SelectedValue.ToString()) > 0)
            {
                _ap.Ma_layout = Convert.ToInt32(_ddlLayout.SelectedValue.ToString());
            }
            else
            {
                _ap.Ma_layout = 0;
            }
            if (!String.IsNullOrEmpty(_trang.Text.Trim()))
            {
                _ap.Trang = Convert.ToInt32(_trang.Text.Trim());
            }
            _return = _apDAL.InsertT_Anphammau_Layout(_ap);

            action.Thaotac = "[Sửa ấn phẩm mẫu - layout]-->[Mã ấn phẩm mẫu - layout:" + _return.ToString() + " ]";
            actionDAL.InserT_Lichsu_Thaotac_Hethong(action);

            GVAnPhamLayout.EditIndex = -1;
            Bind_AnphamMau_Layout();
        }
Beispiel #3
0
        public void Bind_AnphamMau_Layout()
        {
            string where = " Ma_Mau = " + EID.ToString();

            AnPhamMau_LayoutDAL _DAL = new AnPhamMau_LayoutDAL();
            DataSet             _ds;

            Pager1.PageSize = 10;
            _ds             = _DAL.BindGridT_AnPhamLayout(Pager1.PageIndex, Pager1.PageSize, where);

            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 = _DAL.BindGridT_AnPhamLayout(pages.PageIndex - 1, pages.PageSize, where);
            }
            if (_ds.Tables[0].Rows.Count > 0)
            {
                GVAnPhamLayout.DataSource = _ds;
                GVAnPhamLayout.DataBind();
                GVAnPhamLayout.ShowFooter = false;
            }
            else
            {
                _ds.Tables[0].Rows.Add(_ds.Tables[0].NewRow());
                GVAnPhamLayout.DataSource = _ds;
                GVAnPhamLayout.DataBind();
                int columncount = GVAnphamMau.Rows[0].Cells.Count;
                GVAnPhamLayout.Rows[0].Cells.Clear();
                GVAnPhamLayout.Rows[0].Cells.Add(new TableCell());
                GVAnPhamLayout.Rows[0].Cells[0].ColumnSpan = columncount;
                GVAnPhamLayout.Rows[0].Cells[0].Text       = "Không có bản ghi nào";
                GVAnPhamLayout.ShowFooter = false;
            }
            Pager1.TotalRecords     = CurrentPage1.TotalRecords = TotalRecords;
            CurrentPage1.TotalPages = Pager1.CalculateTotalPages();
            CurrentPage1.PageIndex  = Pager1.PageIndex;
        }