예제 #1
0
        public void grdList_EditCommand(object source, DataGridCommandEventArgs 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
            KhachhangDAL objDAL = new KhachhangDAL();
            if (e.CommandArgument.ToString().ToLower() == "edit")
            {
                int cusID = Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString());
                Response.Redirect("~/Phathanh/KhachHangEdit.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + cusID);
            }
            if (e.CommandArgument.ToString().ToLower() == "delete")
            {
                bool _bool;
                _bool = IsCustomerExsits(Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString()));
                if (_bool == false)
                {
                    objDAL.DeleteOneFromT_KhachHang(Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString()));
                    action.Thaotac = "[Xóa T_KhachHang]-->[Thao tác Xóa Trong Bảng T_KhachHang][ID:" + this.grdList.DataKeys[e.Item.ItemIndex].ToString() + " ]";
                    this.Danhsach_Khachhang();
                }
                else
                {
                    return;
                }
            }
            //if (e.CommandArgument.ToString().ToLower() == "sort")
            //{
            //    if (this.ViewState["SortExp"] == null)
            //    {
            //        this.ViewState["SortExp"] = e.CommandArgument.ToString();
            //        this.ViewState["SortOrder"] = "ASC";
            //    }
            //    else
            //    {
            //        if (this.ViewState["SortExp"].ToString() == e.CommandArgument.ToString())
            //        {
            //            if (this.ViewState["SortOrder"].ToString() == "ASC")
            //                this.ViewState["SortOrder"] = "DESC";
            //            else
            //                this.ViewState["SortOrder"] = "ASC";
            //        }
            //        else
            //        {
            //            this.ViewState["SortOrder"] = "ASC";
            //            this.ViewState["SortExp"] = e.CommandArgument.ToString();
            //        }
            //    }

            Danhsach_Khachhang();
        }
예제 #2
0
 public void grdList_EditCommand(object source, DataGridCommandEventArgs 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
     KhachhangDAL objDAL = new KhachhangDAL();
     if (e.CommandArgument.ToString().ToLower() == "edit")
     {
         int cusID = Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString());
         Response.Redirect("~/Danhmuc/EditKhachHang.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + cusID);
     }
     if (e.CommandArgument.ToString().ToLower() == "delete")
     {
         objDAL.DeleteOneFromT_KhachHang(Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString()));
         action.Thaotac = "[Xóa T_KhachHang]-->[Thao tác Xóa Trong Bảng T_KhachHang][ID:" + this.grdList.DataKeys[e.Item.ItemIndex].ToString() + " ]";
         this.Danhsach_Khachhang();
     }
 }