예제 #1
0
        protected void GVDoituong_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("AddNew"))
            {
                TextBox _ma          = (TextBox)GVDoituong.FooterRow.FindControl("txt_MaDoituong");
                TextBox _ten         = (TextBox)GVDoituong.FooterRow.FindControl("txt_Tendoituong");
                TextBox _englishname = (TextBox)GVDoituong.FooterRow.FindControl("txt_EnglishName");
                TextBox _stt         = (TextBox)GVDoituong.FooterRow.FindControl("txt_STT");
                //Label _MaDT = (Label)GVDoituong.FooterRow.FindControl("lblMaDT_Error");
                //Label _STT = (Label)GVDoituong.FooterRow.FindControl("lblSTT_Error");
                int         _return;
                DoituongDAL _doituongDAL = new DoituongDAL();
                if (_doituongDAL.Check_Madoituong(0, _ma.Text.Trim()) > 0)
                {
                    lblMessError.Text     = "Mã đối tượng đã tồn tại";
                    GVDoituong.ShowFooter = true;
                    BindList_Doituong();
                }
                else if (_doituongDAL.Check_STT(0, Convert.ToInt32(_stt.Text.Trim())) > 0)
                {
                    lblMessError.Text     = "Số thứ tự đã tồn tại";
                    GVDoituong.ShowFooter = true;
                    BindList_Doituong();
                }
                else
                {
                    _dt              = new T_Doituong();
                    _dt.ID           = 0;
                    _dt.Ma_Doituong  = _ma.Text.Trim();
                    _dt.Ten_Doituong = _ten.Text.Trim();
                    _dt.EnglishName  = _englishname.Text.Trim();
                    if (!String.IsNullOrEmpty(_stt.Text.Trim()))
                    {
                        _dt.STT = Convert.ToInt32(_stt.Text.Trim());
                    }

                    _dt.Ngaysua    = DateTime.Now;
                    _dt.Nguoitao   = _user.UserID;
                    _dt.Ngaytao    = DateTime.Now;
                    _dt.Nguoisua   = _user.UserID;
                    _return        = _doituongDAL.InsertT_Doituong(_dt);
                    action.Thaotac = "[Thêm mới đối tượng]-->[Mã mã đối tượng:" + _return.ToString() + " ]";
                    actionDAL.InserT_Lichsu_Thaotac_Hethong(action);
                    BindList_Doituong();
                }
            }
        }
예제 #2
0
        protected void GVDoituong_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(GVDoituong.DataKeys[e.RowIndex].Value.ToString());

            TextBox     _ma          = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_MaDoituong");
            TextBox     _ten         = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_Tendoituong");
            TextBox     _englishname = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_EnglishName");
            TextBox     _stt         = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_STT");
            Label       _MaDT        = (Label)GVDoituong.Rows[e.RowIndex].FindControl("lblMaDT_Error");
            Label       _STT         = (Label)GVDoituong.Rows[e.RowIndex].FindControl("lblSTT_Error");
            DoituongDAL _dtDAL       = new DoituongDAL();
            if (_dtDAL.Check_Madoituong(_id, _ma.Text.Trim()) > 0)
            {
                _MaDT.Text = "Mã đối tượng đã tồn tại";
                return;
            }
            else if (_dtDAL.Check_STT(_id, Convert.ToInt32(_stt.Text.Trim())) > 0)
            {
                _STT.Text = "Số thứ tự đã tồn tại";
                return;
            }
            else
            {
                _dt              = new T_Doituong();
                _dt.ID           = _id;
                _dt.Ma_Doituong  = _ma.Text.Trim();
                _dt.Ten_Doituong = _ten.Text.Trim();
                _dt.EnglishName  = _englishname.Text.Trim();
                if (!String.IsNullOrEmpty(_stt.Text.Trim()))
                {
                    _dt.STT = Convert.ToInt32(_stt.Text.Trim());
                }

                _dt.Ngaysua  = DateTime.Now;
                _dt.Nguoitao = _user.UserID;
                _dt.Ngaytao  = DateTime.Now;
                _dt.Nguoisua = _user.UserID;
                _return      = _dtDAL.InsertT_Doituong(_dt);

                action.Thaotac = "[Sửa đối tượng]-->[Mã đối tượng:" + _return.ToString() + " ]";
                actionDAL.InserT_Lichsu_Thaotac_Hethong(action);

                GVDoituong.EditIndex = -1;
                BindList_Doituong();
            }
        }
예제 #3
0
 public int InsertT_Doituong(T_Doituong _Obj)
 {
     try
     {
         return(HPCDataProvider.Instance().InsertObjectReturn(_Obj, "Sp_InsertT_Doituong"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
        protected void GVDoituong_OnRowCommand(object source, GridViewCommandEventArgs e)
        {
            HPCBusinessLogic.Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL();
            T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong();

            if (e.CommandName.Equals("AddNew"))
            {
                TextBox     _ma  = (TextBox)GVDoituong.FooterRow.FindControl("txt_MaDoituong");
                TextBox     _ten = (TextBox)GVDoituong.FooterRow.FindControl("txt_Tendoituong");
                TextBox     _stt = (TextBox)GVDoituong.FooterRow.FindControl("txt_STT");
                int         _return;
                DoituongDAL _doituongDAL = new DoituongDAL();
                if (_doituongDAL.Check_Madoituong(0, _ma.Text.Trim()) > 0)
                {
                    lblMessError.Text     = "Mã đối tượng đã tồn tại";
                    GVDoituong.ShowFooter = true;
                    BindList_Doituong();
                }
                else if (_doituongDAL.Check_STT(0, Convert.ToInt32(_stt.Text.Trim())) > 0)
                {
                    lblMessError.Text     = "Số thứ tự đã tồn tại";
                    GVDoituong.ShowFooter = true;
                    BindList_Doituong();
                }
                else
                {
                    _dt              = new T_Doituong();
                    _dt.ID           = 0;
                    _dt.Ma_Doituong  = _ma.Text.Trim();
                    _dt.Ten_Doituong = _ten.Text.Trim();
                    if (!String.IsNullOrEmpty(_stt.Text.Trim()))
                    {
                        _dt.STT = Convert.ToInt32(_stt.Text.Trim());
                    }

                    _dt.Ngaysua    = DateTime.Now;
                    _dt.Nguoitao   = _user.UserID;
                    _dt.Ngaytao    = DateTime.Now;
                    _dt.Nguoisua   = _user.UserID;
                    _return        = _doituongDAL.InsertT_Doituong(_dt);
                    action.Thaotac = "[Thêm mới đối tượng]-->[Mã mã đối tượng:" + _return.ToString() + " ]";
                    actionDAL.InserT_Lichsu_Thaotac_Hethong(action);
                    lblMessError.Text = "";
                    BindList_Doituong();
                    BinQuytrinhtheoAnPham();
                }

                UltilFunc.RunJavaScriptCode("$.fx.speeds._default = 10; var dlg = jQuery('#dialog').dialog({draggable: true,  resizable: true, hide: 'scale', modal: true, width: 500 }); dlg.parent().appendTo(jQuery('form:first'));");
            }
        }
예제 #5
0
 public string InsertDoiTuong(string ID, string MaDoituong, string TenDoiTuong, string Stt, string MenuID, string IpAddress)
 {
     try
     {
         #region GhiLog
         _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name);
         action.Ma_Nguoidung = _user.UserID;
         action.TenDaydu     = _user.UserName;
         action.HostIP       = IpAddress;
         action.NgayThaotac  = DateTime.Now;
         action.Ma_Chucnang  = int.Parse(MenuID);
         #endregion
         if (ID == "")
         {
             ID = "0";
         }
         int        _id = int.Parse(ID);
         T_Doituong _dt = new T_Doituong();
         _dt.Ma_Doituong  = MaDoituong;
         _dt.Ten_Doituong = TenDoiTuong;
         if (!String.IsNullOrEmpty(Stt.Trim()))
         {
             _dt.STT = Convert.ToInt32(Stt.Trim());
         }
         _dt.Ngaysua  = DateTime.Now;
         _dt.Nguoitao = _user.UserID;
         _dt.Ngaytao  = DateTime.Now;
         _dt.Nguoisua = _user.UserID;
         if (_id == 0)
         {
             DataSet _ds = _DTDAL.Check_Doituong(MaDoituong, TenDoiTuong);
             if (_ds.Tables[0] != null && _ds.Tables[0].Rows.Count > 0)
             {
                 string ten = _ds.Tables[0].Rows[0][0].ToString();
                 string ma  = _ds.Tables[0].Rows[0][1].ToString();
                 if (ten.ToLower() == TenDoiTuong.ToLower())
                 {
                     return("TenDTError");
                 }
                 else if (ma.ToLower() == MaDoituong.ToLower())
                 {
                     return("MaDTError");
                 }
                 return("Đối tượng đã tồn tại");
             }
             else
             {
                 DataSet _dsSTT = _DTDAL.Select_TenDoiTuong_By_Stt(Stt);
                 if (_dsSTT.Tables[0] == null || _dsSTT.Tables[0].Rows.Count == 0)
                 {
                     _dt.ID = 0;
                     int _return = _DTDAL.InsertT_Doituong(_dt);
                     action.Thaotac = "[Thêm mới đối tượng]-->[Mã mã đối tượng:" + _return.ToString() + " ]";
                     actionDAL.InserT_Lichsu_Thaotac_Hethong(action);
                     return("AddSuccess");
                 }
                 else
                 {
                     return("STTError");
                 }
             }
         }
         else
         {
             _dt.ID = _id;
             int _return = _DTDAL.InsertT_Doituong(_dt);
             action.Thaotac = "[Sửa đối tượng]-->[Mã mã đối tượng:" + _return.ToString() + " ]";
             actionDAL.InserT_Lichsu_Thaotac_Hethong(action);
             return("EditSuccess");
         }
     }
     catch
     {
         return("Error,,");
     }
 }
예제 #6
0
        protected void GVDoituong_RowUpdating(object source, 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(GVDoituong.DataKeys[e.RowIndex].Value.ToString());

            TextBox     txtMaDT  = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_MaDoituong");
            TextBox     txtTenDT = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_Tendoituong");
            TextBox     txtSTT   = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_STT");
            Label       _MaDT    = (Label)GVDoituong.Rows[e.RowIndex].FindControl("lblMaDT_Error");
            Label       _STT     = (Label)GVDoituong.Rows[e.RowIndex].FindControl("lblSTT_Error");
            DoituongDAL _dtDAL   = new DoituongDAL();
            try
            {
                int.Parse(txtSTT.Text);
            }
            catch (Exception)
            {
                lblMessError.Text = "Nhập lại số thứ tự";
                throw;
            }
            if (_dtDAL.Check_Madoituong(_id, txtMaDT.Text.Trim()) > 0)
            {
                _MaDT.Text = "Mã đối tượng đã tồn tại";
                return;
            }
            else if (_dtDAL.Check_STT(_id, Convert.ToInt32(txtSTT.Text.Trim())) > 0)
            {
                _STT.Text = "Số thứ tự đã tồn tại";
                return;
            }
            else
            {
                _dt              = new T_Doituong();
                _dt.ID           = _id;
                _dt.Ma_Doituong  = txtMaDT.Text.Trim();
                _dt.Ten_Doituong = txtTenDT.Text.Trim();
                if (!String.IsNullOrEmpty(txtSTT.Text.Trim()))
                {
                    _dt.STT = Convert.ToInt32(txtSTT.Text.Trim());
                }

                _dt.Ngaysua  = DateTime.Now;
                _dt.Nguoitao = _user.UserID;
                _dt.Ngaytao  = DateTime.Now;
                _dt.Nguoisua = _user.UserID;
                _return      = _dtDAL.InsertT_Doituong(_dt);

                action.Thaotac = "[Sửa đối tượng]-->[Mã đối tượng:" + _return.ToString() + " ]";
                actionDAL.InserT_Lichsu_Thaotac_Hethong(action);
                lblMessError.Text    = "";
                GVDoituong.EditIndex = -1;
                BindList_Doituong();
                BinQuytrinhtheoAnPham();
            }

            UltilFunc.RunJavaScriptCode("$.fx.speeds._default = 10; var dlg = jQuery('#dialog').dialog({draggable: true,  resizable: true, hide: 'scale', modal: true, width: 500 }); dlg.parent().appendTo(jQuery('form:first'));");
        }