コード例 #1
0
 /// <summary>
 /// 通过用户区域id,用户名,身份证后六位,员工id,生日,得到用户的登录id,判断是否为光宝员工
 /// </summary>
 /// <param name="lu"></param>
 /// <returns></returns>
 public static String MobilePortal_NoEmailEmployeeCheck(LiteonUser lu)
 {
     DBHelper.SetConnstr(CObject.Liteon_base);
     SqlParameter[] p = new SqlParameter[] {
         new SqlParameter("@SiteCode", SqlDbType.NVarChar, 20)
         {
             Value = lu.SiteCode
         },
         new SqlParameter("@UserName", SqlDbType.NVarChar, 30)
         {
             Value = lu.UserName
         },
         new SqlParameter("@IDNumber", SqlDbType.NVarChar, 20)
         {
             Value = lu.IDNumber
         },
         new SqlParameter("@EmployeeID", SqlDbType.NVarChar, 30)
         {
             Value = lu.EmployeeID
         },
         new SqlParameter("@Birthdate", SqlDbType.DateTime)
         {
             Value = lu.Birthdate
         },
         new SqlParameter("@EmployeeLoginID", SqlDbType.NVarChar, 20)
         {
             Direction = ParameterDirection.Output
         }
     };
     DBHelper.UseBoolProc("MobilePortal_NoEmailEmployeeCheck", p);
     if (p[5].Value == null || p[5].Value is DBNull)
     {
         return(null);
     }
     return(p[5].Value.ToString());
 }
コード例 #2
0
        public HttpResponseMessage Regsiters(dynamic para)
        {
            LiteonUser lu = new LiteonUser();


            String cq     = para.cq;
            String xm     = para.xm;
            String sfz    = para.sfz;
            String gh     = para.gh;
            String sr     = para.sr;
            String mm     = para.mm;
            String userid = cq.ToUpper() + gh;

            lu.Birthdate  = Convert.ToDateTime(sr);
            lu.IDNumber   = sfz;
            lu.SiteCode   = cq;
            lu.UserName   = xm;
            lu.EmployeeID = gh;
            String loginid = LiteonMethod.MobilePortal_NoEmailEmployeeCheck(lu);

            if (!String.IsNullOrEmpty(loginid))
            {
                var le     = EFClass.GetEF();
                var uilist = le.UserInfo.Where(p => p.UserID == userid).ToList();
                if (uilist.Count == 0)
                {
                    //该帐号没有被注册
                    UserInfo ui = new UserInfo();
                    ui.UserID       = userid;
                    ui.Region       = cq;
                    ui.UserName     = xm;
                    ui.RegisterDate = DateTime.Now;
                    ui.GUID         = Guid.NewGuid().ToString();
                    ui.EmployeeID   = gh;
                    le.UserInfo.Add(ui);
                    Users u = new Users();
                    u.Password  = mm;
                    u.GUID      = Guid.NewGuid().ToString();
                    u.UserID    = userid;
                    u.LoginDate = DateTime.Now;
                    le.Users.Add(u);
                    int result = le.SaveChanges();

                    if (result > 0)
                    {
                        rm.ResponseState   = ResponseState.Successed;
                        rm.ResponseMessage = "添加成功!";
                        rm.ResponseData    = userid;
                    }
                    else
                    {
                        rm.ResponseState   = ResponseState.Failed;
                        rm.ResponseMessage = "添加失败!";
                    }
                    return(ToJson.toJson(rm));
                }
                else
                {
                    rm.ResponseState   = ResponseState.Failed;
                    rm.ResponseMessage = "该帐号已被注册";
                    return(ToJson.toJson(rm));
                }
            }
            else
            {
                rm.ResponseState   = ResponseState.Failed;
                rm.ResponseMessage = "您不是光宝员工!";
                return(ToJson.toJson(rm));
            }
        }