예제 #1
0
        protected void btnAddMenu_Click(object sender, EventArgs e)
        {
            string _thaotac = string.Empty;

            if (txt_butdanh.Text.Trim().Length == 0)
            {
                FuncAlert.AlertJS(this, "Bạn chưa nhập bút danh");
                return;
            }

            T_Nguoidung _obj    = SetItem();
            int         _return = 0;

            if (userID != 0)
            {
                _return = userID;
            }
            if (_return != 0)
            {
                if (!isExist(txt_butdanh.Text.Trim(), userID))
                {
                    _return  = _NguoidungDAL.InsertT_Nguoidung(_obj);
                    _thaotac = "[Sửa bút danh]-->[ID:" + _return.ToString() + " ]";
                }
                else
                {
                    FuncAlert.AlertJS(this, "Bút danh đã tồn tại!");
                    return;
                }
            }
            else
            {
                if (!Page.IsValid)
                {
                    return;
                }
                if (!isExist(txt_butdanh.Text.Trim()))
                {
                    _return  = _NguoidungDAL.InsertT_Nguoidung(_obj);
                    _thaotac = "[Thêm mới bút danh]-->[ID:" + _return.ToString() + " ]";
                }
                else
                {
                    FuncAlert.AlertJS(this, "Bút danh đã tồn tại!");
                    return;
                }
            }
            txt_butdanh.Text = "";
            userID           = 0;
            btnAddMenu.Text  = "Thêm mới";
            UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), _thaotac);
            LoadData();
        }
예제 #2
0
        protected void linkSave_Click(object sender, EventArgs e)
        {
            string  _thaotac = string.Empty;
            T_Users _obj     = SetItem();

            if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty)
            {
                UserID_SSO = int.Parse(Request["ID"].ToString());
            }
            if (UserID_SSO == 0)
            {
                if (password1.Text.Trim() != password2.Text.Trim())
                {
                    FuncAlert.AlertJS(this, CommonLib.ReadXML("lblMatkhaukhongphuhop"));
                    return;
                }
                Regex regex5 = new Regex("^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*?[#?!@$%^&*-])(?=^.{6,100}$)");

                Match match5 = regex5.Match(password1.Text);
                if (!match5.Success)
                {
                    FuncAlert.AlertJS(this, CommonLib.ReadXML("lblMatkhauthongbao"));
                    return;
                }
                if (!isExist_SSO(txtUserName.Text.Trim()))
                {
                    if (!isExistCMTND(txtUserName.Text.Trim(), txt_CMTND.Text.Trim()))
                    {
                        if (!Page.IsValid)
                        {
                            return;
                        }
                        UserID_SSO = _userDAL.InsertT_Users(_obj);
                        T_Nguoidung _objnguoidung = SetItemNguoidung(UserID_SSO);
                        _userDAL.InsertT_Nguoidung(_objnguoidung);
                        _thaotac = "Thao tác thêm mới người dùng:" + _obj.UserFullName + "-->[USERID:" + UserID_SSO.ToString() + " ]";
                        Clear();
                    }
                    else
                    {
                        FuncAlert.AlertJS(this, CommonLib.ReadXML("lblCMdatontai"));
                        return;
                    }
                }
                else
                {
                    FuncAlert.AlertJS(this, CommonLib.ReadXML("lblTaikhoandatontai"));
                    return;
                }
            }
            else
            {
                if (!isExist_SSO(txtUserName.Text.Trim(), double.Parse(Page.Request["ID"].ToString())))
                {
                    if (!isExistCMTND(UserID_SSO, txtUserName.Text.Trim(), txt_CMTND.Text.Trim()))
                    {
                        UserID_SSO = _userDAL.InsertT_Users(_obj);
                        string _sql_update = "update T_Nguoidung set Ngaysinh=convert(datetime,'" + txtBirth.Text.Trim() + "',103),CMTND=N'" + txt_CMTND.Text.Trim() + "',Diachi=N'" + txtAddress.Text.Trim() + "', Mobile=N'" + txtPhoneNumber.Text.Trim() + "', Ma_Vung=" + cbo_vungmien.SelectedValue + ",Ma_PhongBan=" + cbo_phongban.SelectedValue + " where Loai=0 and NguoiTao=" + UserID_SSO;
                        ulti.ExecSql(_sql_update);
                        _thaotac = "Thao tác sửa thông tin người dùng: " + _obj.UserFullName + "[USERID:" + UserID_SSO.ToString() + " ]";
                    }
                    else
                    {
                        FuncAlert.AlertJS(this, CommonLib.ReadXML("lblCMdatontai"));
                        return;
                    }
                }
                else
                {
                    FuncAlert.AlertJS(this, CommonLib.ReadXML("lblTaikhoandatontai"));
                    return;
                }
                Clear();
            }
            UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), _thaotac);
            FuncAlert.AlertJS(this, "Thêm mới thành công");
        }
예제 #3
0
        protected void linkSave_Click(object sender, EventArgs e)
        {
            string _thaotac = string.Empty;

            if (txtUserName.Text.Trim().Length == 0)
            {
                FuncAlert.AlertJS(this, "Bạn chưa nhập bút danh CTV");
                return;
            }
            if (txtFullName.Text.Trim().Length == 0)
            {
                FuncAlert.AlertJS(this, "Bạn chưa nhập họ tên đầy đủ CTV");
                return;
            }
            if (cbo_vungmien.SelectedIndex == 0)
            {
                FuncAlert.AlertJS(this, "Bạn chưa nhập vùng miền CTV");
                return;
            }
            T_Nguoidung _obj    = SetItem();
            int         _return = 0;

            if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty)
            {
                _return = int.Parse(Request["ID"].ToString());
            }
            if (_return != 0)
            {
                if (!isExist(txtUserName.Text.Trim(), double.Parse(Page.Request["ID"].ToString())))
                {
                    string checkexitsCMTND = " CMTND=N'" + txt_CMTND.Text.Trim() + "' and Nguoitao=" + _user.UserID.ToString() + " and Loai=1 and Ma_Nguoidung<>" + Page.Request["id"].ToString();
                    if (!isExistCMTND(checkexitsCMTND))
                    {
                        _return  = _userDAL.InsertT_Nguoidung(_obj);
                        _thaotac = "[Sửa CTV]-->[Thao tác sửa][CTVID:" + _return.ToString() + " ]";
                        System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("UpdateSuccessfully") + "');", true);
                    }
                    else
                    {
                        FuncAlert.AlertJS(this, "CMTND đã tồn tại!");
                        return;
                    }
                }
                else
                {
                    FuncAlert.AlertJS(this, "Bút danh CTV này đã tồn tại!");
                    return;
                }
            }
            else
            {
                if (!Page.IsValid)
                {
                    return;
                }
                if (!isExist(txtUserName.Text.Trim()))
                {
                    string checkexitsCMTND = " CMTND=N'" + txt_CMTND.Text.Trim() + "' and Loai=1 and Nguoitao=" + _user.UserID.ToString();
                    if (!isExistCMTND(checkexitsCMTND))
                    {
                        _return  = _userDAL.InsertT_Nguoidung(_obj);
                        _thaotac = "[Thêm mới CTV]-->[Thao tác Thêm][CTVID:" + _return.ToString() + " ]";
                        System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("VALIDATE_ADDNEWS") + "');", true);
                    }
                    else
                    {
                        FuncAlert.AlertJS(this, "CMTND đã tồn tại!");
                        return;
                    }
                }
                else
                {
                    FuncAlert.AlertJS(this, "Bút danh CTV này đã tồn tại!");
                    return;
                }
            }
            UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), _thaotac);
            FuncAlert.AlertJS(this, "Thêm mới CTV thành công");
        }