Beispiel #1
0
        public VenderUser LogOn(string userCode, string psw)
        {
            using (var DbScope = new OperationDatabaseScope(new OperationDatabaseContext("NewWeb")))
            {
            //Microsoft.Practices.EnterpriseLibrary.Data.Database db = Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase("NewWeb");
                try
                {
                    VenderUser userInfo = DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<VenderUser>("NewWebCommon", "GetUserInfo", userCode, EncryptHelper.EncryptDES(psw)).FirstOrDefault();
                    if (userInfo != null)
                    {

                    }
                    else
                    {
                        userInfo = new VenderUser() { ErrorMsg = "登录户名或密码不正确" };
                    }
                    return userInfo;
                }
                catch (Exception ex)
                {
                    MB.Util.TraceEx.Write(ex.Message);

                }

                return null;
            }
        }
        public string Saves()
        {
            string sjson = string.Empty;
            try
            {
                string name = Request["txtUserName"];
                string code = Request["txtUserCode"];
                string pwd1 = Request["txtpassword"];
                string pwd2 = Request["txtpwd"];
                int vid = int.Parse(Request["VENDERID"]);
                if (pwd1.Length < 6 || pwd2.Length < 6)
                {
                    return sjson = "{success:false,msg:'请输入6位的密码'}";
                }
                if (pwd1 != pwd2)
                {
                    return sjson = "{success:false,msg:'两次密码不一致'}";
                }
                VenderUser user = new VenderUser();
                user.VUSERCODE = code;
                user.PASSWORD = pwd1;
                user.VENDERID = vid;
                user.USERNAME = name;

                NewCommon nc = new NewCommon();
                 VenderUser checkuser= nc.CheckVenderUser(code);
                 if (checkuser != null)
                 {
                     sjson = "{success:false,msg:'该登录名已存在!'}";
                 }
                 else
                 {
                     nc.AddVenderUser(user);
                     sjson = "{success:true}";
                 }
            }
            catch (Exception ex)
            {
                sjson = "{success:false,msg:" + ex.Message + "}";
            }
            return sjson;
        }
Beispiel #3
0
 /// <summary>
 /// 新增供应商用户
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public int AddVenderUser(VenderUser user)
 {
     user.PASSWORD = EncryptHelper.EncryptDES(user.PASSWORD);
     return DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQueryByEntity<VenderUser>
                     ("NewWebCommon", "AddVenderUser", user);
 }