Exemplo n.º 1
0
    public void EditOpenID(string JSon, string version)
    {
        try
        {
            string   openid     = string.Empty;
            string   CompUserID = string.Empty;
            JsonData JInfo      = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["CompUserID"].ToString() != "")
            {
                openid     = JInfo["OpenID"].ToString().Trim();
                CompUserID = JInfo["CompUserID"].ToString().Trim();
            }
            else
            {
                return;
            }
            Hi.Model.SYS_CompUser compuser = new Hi.BLL.SYS_CompUser().GetModel(int.Parse(CompUserID));
            if (compuser == null || compuser.IsAudit != 2 || compuser.dr == 1 || compuser.IsEnabled != 1)
            {
                return;
            }
            Hi.BLL.SYS_Users   bll_user = new Hi.BLL.SYS_Users();
            Hi.Model.SYS_Users user     = bll_user.GetModel(compuser.UserID);
            if (user == null || user.AuditState != 2 || user.dr == 1 || user.IsEnabled != 1)
            {
                return;
            }

            if (openid == "")
            {
                user.OpenID = "";
            }
            else
            {
                user.OpenID = openid + "&&" + compuser.ID;
            }
            user.ts         = DateTime.Now;
            user.modifyuser = user.ID;



            bll_user.Update(user);
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "EditOpenID:" + JSon);
            return;
        }
    }
Exemplo n.º 2
0
    /// <summary>
    ///核心企业修改经销商登录信息
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ResultEditResellerAccount EditResellerAccount(string JSon)
    {
        string UserID    = string.Empty;
        string CompID    = string.Empty;
        string AccountID = string.Empty;
        string TrueName  = string.Empty;
        string ts        = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo["UserID"].ToString().Trim() == "" || JInfo["CompID"].ToString().Trim() == "" || JInfo["AccountID"].ToString().Trim() == "" ||
                JInfo["TrueName"].ToString().Trim() == "" || JInfo["ts"].ToString().Trim() == "")
            {
                return(new ResultEditResellerAccount()
                {
                    Result = "F", Description = "参数异常"
                });
            }
            UserID    = JInfo["UserID"].ToString();
            CompID    = JInfo["CompID"].ToString();
            AccountID = JInfo["AccountID"].ToString();
            TrueName  = Common.NoHTML(JInfo["TrueName"].ToString());
            ts        = JInfo["ts"].ToString();
            //判断登录信息是否异常
            Hi.Model.SYS_Users one = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out one, Int32.Parse(CompID)))
            {
                return(new ResultEditResellerAccount()
                {
                    Result = "F", Description = "登录信息异常"
                });
            }
            //判断核心企业信息是否异常
            Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Int32.Parse(CompID));
            if (comp == null || comp.dr == 1 || comp.IsEnabled == 0 || comp.AuditState == 0)
            {
                return new ResultEditResellerAccount()
                       {
                           Result = "F", Description = "核心企业信息异常"
                       }
            }
            ;
            #endregion
            //根据登录信息ID获取对应的sys_users中数据
            Hi.BLL.SYS_Users   bll_users = new Hi.BLL.SYS_Users();
            Hi.Model.SYS_Users account   = bll_users.GetModel(Int32.Parse(AccountID));
            //判断用户信息是否正常
            if (account == null)
            {
                return new ResultEditResellerAccount()
                       {
                           Result = "F", Description = "登录信息异常"
                       }
            }
            ;
            if (account.dr == 1)
            {
                return new ResultEditResellerAccount()
                       {
                           Result = "F", Description = "登录信息已被删除"
                       }
            }
            ;
            if (ts != account.ts.ToString())
            {
                return new ResultEditResellerAccount()
                       {
                           Result = "F", Description = "登录信息已被他人修改,请稍后再试"
                       }
            }
            ;
            //修改姓名
            account.TrueName = TrueName;
            if (!bll_users.Update(account))
            {
                return new ResultEditResellerAccount()
                       {
                           Result = "F", Description = "修改失败"
                       }
            }
            ;
            //成功需要将新的登录信息返回回去
            class_ver3.Account result_account = new class_ver3.Account();
            result_account.AccountID = account.ID.ToString();
            result_account.UserName  = account.UserName;
            result_account.TrueName  = account.TrueName;
            result_account.Phone     = account.Phone;
            return(new ResultEditResellerAccount()
            {
                Result = "T", Description = "返回成功", Account = result_account
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "EidtResellerAccount:" + JSon);
            return(new ResultEditResellerAccount()
            {
                Result = "F", Description = "修改失败"
            });
        }
    }