Пример #1
0
        protected void GVAnphamMau_OnRowCommand1(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("Mangxec"))
            {
                GridViewRow row = (GridViewRow)((Control)e.CommandSource).Parent.Parent;
                EID = (int)GVAnphamMau.DataKeys[row.RowIndex].Values[0];
                if (EID != 0)
                {
                    LoadDataApprovied();
                    PopupMangXec.Show();
                }
            }
            if (e.CommandName.Equals("AddNew"))
            {
                TextBox      _mota      = (TextBox)GVAnphamMau.FooterRow.FindControl("txt_mota");
                DropDownList _ddlAnpham = (DropDownList)GVAnphamMau.FooterRow.FindControl("ddl_AnPham");
                int          _return;
                AnPhamMauDAL _apDAL = new AnPhamMauDAL();
                _ap        = new T_AnPhamMau();
                _ap.MA_Mau = 0;
                _ap.Mota   = _mota.Text.Trim();

                if (Convert.ToInt32(_ddlAnpham.SelectedValue.ToString()) > 0)
                {
                    _ap.Ma_Anpham = Convert.ToInt32(_ddlAnpham.SelectedValue.ToString());
                }
                else
                {
                    _ap.Ma_Anpham = 0;
                }

                _return        = _apDAL.InsertT_Anphammau(_ap);
                action.Thaotac = "[Thêm mới ấn phẩm mẫu]-->[Mã ấn phẩm mẫu:" + _return.ToString() + " ]";
                actionDAL.InserT_Lichsu_Thaotac_Hethong(action);
                BindList_AnphamMau();
            }
        }
Пример #2
0
        protected void GVAnphamMau_RowDeleting(object sender, GridViewDeleteEventArgs 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          _id    = Convert.ToInt32(GVAnphamMau.DataKeys[e.RowIndex].Value);
            AnPhamMauDAL _apDAL = new AnPhamMauDAL();
            _apDAL.DeleteOneFromT_Anphammau(_id);

            action.Thaotac = "[Xóa ấn phẩm mẫu]-->[Mã ấn phẩm mẫu:" + _id.ToString() + " ]";
            actionDAL.InserT_Lichsu_Thaotac_Hethong(action);

            BindList_AnphamMau();
        }
Пример #3
0
        public void BindList_AnphamMau()
        {
            string where = " 1=1 ";

            AnPhamMauDAL _DAL = new AnPhamMauDAL();
            DataSet      _ds;

            pages.PageSize = 10;
            _ds            = _DAL.BindGridT_Anphammau(pages.PageIndex, pages.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_Anphammau(pages.PageIndex - 1, pages.PageSize, where);
            }
            if (_ds.Tables[0].Rows.Count > 0)
            {
                GVAnphamMau.DataSource = _ds;
                GVAnphamMau.DataBind();
                GVAnphamMau.ShowFooter = false;
            }
            else
            {
                _ds.Tables[0].Rows.Add(_ds.Tables[0].NewRow());
                GVAnphamMau.DataSource = _ds;
                GVAnphamMau.DataBind();
                int columncount = GVAnphamMau.Rows[0].Cells.Count;
                GVAnphamMau.Rows[0].Cells.Clear();
                GVAnphamMau.Rows[0].Cells.Add(new TableCell());
                GVAnphamMau.Rows[0].Cells[0].ColumnSpan = columncount;
                GVAnphamMau.Rows[0].Cells[0].Text       = "Không có bản ghi nào";
                GVAnphamMau.ShowFooter = false;
            }
            pages.TotalRecords     = curentPages.TotalRecords = TotalRecords;
            curentPages.TotalPages = pages.CalculateTotalPages();
            curentPages.PageIndex  = pages.PageIndex;
            Session["CurrentPage"] = pages.PageIndex;
        }
Пример #4
0
        protected void GVAnphamMau_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(GVAnphamMau.DataKeys[e.RowIndex].Value.ToString());

            TextBox      _mota      = (TextBox)GVAnphamMau.Rows[e.RowIndex].FindControl("txt_mota");
            DropDownList _ddlAnpham = (DropDownList)GVAnphamMau.Rows[e.RowIndex].FindControl("ddl_AnPham");

            AnPhamMauDAL _apDAL = new AnPhamMauDAL();
            _ap        = new T_AnPhamMau();
            _ap.MA_Mau = _id;
            _ap.Mota   = _mota.Text.Trim();

            if (Convert.ToInt32(_ddlAnpham.SelectedValue.ToString()) > 0)
            {
                _ap.Ma_Anpham = Convert.ToInt32(_ddlAnpham.SelectedValue.ToString());
            }
            else
            {
                _ap.Ma_Anpham = 0;
            }

            _return = _apDAL.InsertT_Anphammau(_ap);

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

            GVAnphamMau.EditIndex = -1;
            BindList_AnphamMau();
        }