Пример #1
0
 public int AddOrgUser(OrgUsers model)
 {
     string cmdText = "insert into  OrgUsers (orgId,uid)  values(@orgId,@uid)";
     SqlParameter[] parameters =
     {
         SqlParamHelper.MakeInParam("@orgId",SqlDbType.Int,4,model.OrgId),
         SqlParamHelper.MakeInParam("@uid",SqlDbType.Int,4,model.Uid)
     };
     return SqlHelper.ExecuteNonQuery(WriteConnectionString,CommandType.Text,cmdText,parameters);
 }
Пример #2
0
        private void SaveUser()
        {
            string login = GetRequestString("login");
            string pass = GetRequestString("pass");
            string name = GetRequestString("name");
            string sex = GetRequestString("sex");
            string email = GetRequestString("email");
            string tel = GetRequestString("tel");
            string mobile = GetRequestString("mobile");
            string status = GetRequestString("status");
            string org = GetRequestString("org");
            string role = GetRequestString("role");
            UserInfo item1 = new UserInfo();
            UserLogin model = new UserLogin();
            int Userid = GetRequestString("Userid").ToInt32(-1);
            if(Userid != -1){
                item1 = userService.GetUserInfo(Userid);
                model = userService.GetUserLogin(Userid);
            }
            else{
                Userid = userService.GetMaxUid();

                //if (Userid == "1")
                //{
                //    Userid = "1000000000";
                //}
                item1.AddDate = DateTime.Now;
            }
            item1.Email = email;
            item1.Mobile = mobile;
            item1.Sex = sex.ToInt32();
            item1.Tel = tel;
            item1.Uid = Userid;
            item1.TrueName = name;

            model.LoginName = login;
            if(!string.IsNullOrEmpty(pass)){
                model.LoginPassword = CryptoHelper.MD5_Encrypt(pass);
            }
            model.Status = int.Parse(status);
            model.Uid = Userid.ToInt32();
            userService.DeleteOrgUser(Userid);
            if(!org.IsNullOrEmpty()){
                OrgUsers omodel = new OrgUsers();
                omodel.OrgId = int.Parse(org);
                omodel.Uid = Userid;
                userService.AddOrgUser(omodel);
            }
            if(!GetRequestString("Userid").IsNullOrEmpty()){
                userService.EditUserInfo(item1);
                userService.EditUserLogin(model);
            }
            else{
                if(userService.ExistsLoginName(login)){
                    userService.DeleteOrgUser(Userid);
                    Response.Write("false");
                }
                else{
                    userService.AddUserInfo(item1);
                    userService.AddUserLogin(model);
                }
            }
            saveRole(Userid,role);
        }
Пример #3
0
        private void Register()
        {
            string login = GetRequestString("login");
            string pass = GetRequestString("pass");
            string name = GetRequestString("name");
            int sex = GetRequestString("sex").ToInt32(0);
            string email = GetRequestString("email");
            string tel = GetRequestString("tel");
            string mobile = GetRequestString("mobile");
            string attach = GetRequestString("attach");

            if(userService.ExistsLoginName(login)){
                Response.Write("false");
                return;
            }

            int uid = userService.GetMaxUid();

            UserLogin model = new UserLogin
            {
                Uid = uid,
                LoginName = login,
                LoginPassword = CryptoHelper.MD5_Encrypt(pass),
                Status = 0
            };
            userService.AddUserLogin(model);

            UserInfo userinfo = new UserInfo
            {
                Uid = uid,
                TrueName = name,
                Email = email,
                Sex = sex,
                Tel = tel,
                Mobile = mobile
            };
            userinfo.Uid = userService.AddUserInfo(userinfo);

            OrgUsers orgUser = new OrgUsers {OrgId = orgService.GetOrgRootId(),Uid = uid};
            userService.AddOrgUser(orgUser);

            Dictionary<int,string> dict = new Dictionary<int,string>();
            dict.Add(uid,attach);
            userService.AddRegisterAttach(dict);
        }
Пример #4
0
 public int AddOrgUser(OrgUsers model)
 {
     return _UserRepository.AddOrgUser(model);
 }