Example #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
     CongviecDAL objDAL = new CongviecDAL();
     if (e.CommandArgument.ToString().ToLower() == "edit")
     {
         int cvID = Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString());
         Response.Redirect("~/Congviec/EditCongviec.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + cvID);
     }
     if (e.CommandArgument.ToString().ToLower() == "delete")
     {
         objDAL.DeleteOneFromT_Congviec(Convert.ToDouble(this.grdList.DataKeys[e.Item.ItemIndex].ToString()), _user.UserID);
         action.Thaotac = "[Xóa T_Congviec]-->[Thao tác Xóa Trong Bảng T_Congviec][ID:" + this.grdList.DataKeys[e.Item.ItemIndex].ToString() + " ]";
         this.BindList_CongViec();
     }
 }
Example #2
0
        public void grdListCVCanLam_EditCommand(object source, DataGridCommandEventArgs e)
        {
            string Thaotac = string.Empty;
            string _ID     = string.Empty;

            if (TabContainerListCV.ActiveTabIndex == 0)
            {
                _ID = grdListCVCanLam.DataKeys[e.Item.ItemIndex].ToString();
            }
            else if (TabContainerListCV.ActiveTabIndex == 1)
            {
                _ID = grdListTheodoi.DataKeys[e.Item.ItemIndex].ToString();
            }
            int tab = 0;

            tab = TabContainerListCV.ActiveTabIndex;
            TextBox txt_phanhoi = (TextBox)e.Item.FindControl("txt_phanhoi");

            if (e.CommandArgument.ToString().ToLower() == "edit")
            {
                if (tab != 1)
                {
                    Response.Redirect("~/Congviec/NoidungCV.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + _ID + "&Tab=" + tab.ToString());
                }
                else
                {
                    Response.Redirect("~/Congviec/EditCongviec.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + _ID + "&Tab=" + tab.ToString());
                }
            }
            else if (e.CommandArgument.ToString().ToLower() == "nhanviec")
            {
                string sql = "update T_Congviec set Loai=0,Vet=N'" + txt_phanhoi.Text.Trim() + "', NguoiNhan=" + _user.UserID + ", TenNguoiNhan=N'" + _user.UserFullName + "' where Ma_Congviec=" + _ID;
                ulti.ExecSql(sql);
                Thaotac = _user.UserFullName + "thực hiện nhận việc " + _DALCV.GetOneFromT_CongviecByID(double.Parse(_ID)).Tencongviec;
            }
            else if (e.CommandArgument.ToString().ToLower() == "finishcv")
            {
                string sql     = string.Empty;
                int    _status = UltilFunc.GetColumnValuesOne("T_Congviec", "Status", " Ma_Congviec=" + _ID);
                if (_status == 0)
                {
                    sql = "update T_Congviec set Status=1,Vet=N'" + txt_phanhoi.Text.Trim() + "', NguoiNhan=" + _user.UserID + ", TenNguoiNhan=N'" + _user.UserFullName + "' where Ma_Congviec=" + _ID;
                }
                else
                {
                    sql = "update T_Congviec set Status=0,Vet=N'" + txt_phanhoi.Text.Trim() + "', NguoiNhan=" + _user.UserID + ", TenNguoiNhan=N'" + _user.UserFullName + "' where Ma_Congviec=" + _ID;
                }
                ulti.ExecSql(sql);
                Thaotac = _user.UserFullName + "thực hiện hoàn thành công việc " + _DALCV.GetOneFromT_CongviecByID(double.Parse(_ID)).Tencongviec;
            }
            else if (e.CommandArgument.ToString().ToLower() == "cancelcv")
            {
                string sql = "update T_Congviec set Status=0, Vet=N'" + txt_phanhoi.Text.Trim() + "',NguoiNhan=0, TenNguoiNhan=N'" + _user.UserFullName + "' where Ma_Congviec=" + _ID;
                ulti.ExecSql(sql);
                Thaotac = _user.UserFullName + "thực hiện hủy việc " + _DALCV.GetOneFromT_CongviecByID(double.Parse(_ID)).Tencongviec;
            }
            else if (e.CommandArgument.ToString().ToLower() == "phanhoi")
            {
                string sql = "update T_Congviec set Vet=N'" + txt_phanhoi.Text.Trim() + "',TenNguoiNhan=N'" + _user.UserFullName + "' where Ma_Congviec=" + _ID;
                ulti.ExecSql(sql);
            }
            else if (e.CommandArgument.ToString().ToLower() == "delete")
            {
                Thaotac = "Thực hiện xóa công viêc " + _DALCV.GetOneFromT_CongviecByID(double.Parse(_ID)).Tencongviec;
                _DALCV.DeleteOneFromT_Congviec(double.Parse(_ID), _user.UserID);
            }
            UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), Thaotac);
            this.TabContainerListCV.ActiveTabIndex = tab;
            this.TabContainer1_ActiveTabChanged(source, e);
        }