コード例 #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
     HPCBusinessLogic.DAL.YeucauDAL objDAL = new HPCBusinessLogic.DAL.YeucauDAL();
     if (e.CommandArgument.ToString().ToLower() == "edit")
     {
         int cusID = Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString());
         Response.Redirect("~/Phathanh/YeucauPHEdit.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + cusID);
     }
     if (e.CommandArgument.ToString().ToLower() == "isstatus")
     {
         double _ID    = Convert.ToDouble(this.grdList.DataKeys[e.Item.ItemIndex].ToString());
         Int16  _check = objDAL.GetOneFromT_YeuCauByID(_ID).Trangthai;
         if (_check == 0)
         {
             objDAL.UpdateinfoT_Yeucau(" [Trangthai] = 1 where ID = " + _ID.ToString());
             action.Thaotac = "[Cập nhật trạng thái bảng T_Yeucau][ID:" + _ID.ToString() + " ][Trangthai = 1]";
             Danhsach_Yeucau();
         }
         if (_check == 1)
         {
             bool _bool;
             _bool = IsHopdongExsits(Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString()));
             if (_bool == false)
             {
                 objDAL.UpdateinfoT_Yeucau(" [Trangthai] = 0 where ID = " + _ID.ToString());
                 action.Thaotac = "[Cập nhật trạng thái bảng T_Yeucau][ID:" + _ID.ToString() + " ][Trangthai = 0]";
             }
             else
             {
                 System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Yêu cầu này đã làm hợp đồng!');", true);
                 return;
             }
             Danhsach_Yeucau();
         }
     }
     if (e.CommandArgument.ToString().ToLower() == "delete")
     {
         bool _bool;
         _bool = IsHopdongExsits(Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString()));
         if (_bool == false)
         {
             objDAL.DeleteFromT_YeuCauQCByID(Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString()));
             action.Thaotac = "[Thao tác Xóa Trong Bảng T_Yeucau][ID:" + this.grdList.DataKeys[e.Item.ItemIndex].ToString() + " ]";
             Danhsach_Yeucau();
         }
         else
         {
             return;
         }
     }
 }
コード例 #2
0
        protected void Save_Click(object sender, EventArgs 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
            this.Page.Validate(vs_Themmoi.ValidationGroup);
            if (!Page.IsValid)
            {
                return;
            }
            HopdongDAL _hopdongDAL = new HopdongDAL();
            T_Hopdong  _hopdong    = SetItem();

            int menuID = 0;
            if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty)
            {
                menuID = int.Parse(Request["ID"].ToString());
            }
            int _return = _hopdongDAL.InsertT_Hopdong(_hopdong);
            if (Page.Request.Params["id"] == null)
            {
                #region Update T_Yeucau khi da co hop dong --> Trangthai = 2

                HPCBusinessLogic.DAL.YeucauDAL _yeucauDAL = new HPCBusinessLogic.DAL.YeucauDAL();
                _yeucauDAL.UpdateinfoT_Yeucau(" [Trangthai] = 2 where ID = " + ddl_Yeucau.SelectedValue.ToString());

                #endregion
                action.Thaotac = "[Thêm mới hợp đồng]-->[mã hợp đồng:" + _return.ToString() + " ]";
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("VALIDATE_ADDNEWS") + "');", true);
                actionDAL.InserT_Lichsu_Thaotac_Hethong(action);
                Clear();
                BindCombo();
                return;
            }
            if (Page.Request.Params["id"] != null)
            {
                action.Thaotac = "[Sửa hợp đồng]-->[Mã hợp đồng:" + Page.Request["id"].ToString() + " ]";
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("UpdateSuccessfully") + "');", true);
                actionDAL.InserT_Lichsu_Thaotac_Hethong(action);
                Clear();
                BindCombo();
                return;
            }
        }