Beispiel #1
0
    //public Hi.Model.SYS_Users user = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        //user = LoginModel.IsLogined(this);
        string MessAgeID = Request["id"].ToString();

        if (!string.IsNullOrEmpty(MessAgeID))
        {
            if (!Common.PageDisOperable("Message", Convert.ToInt32(MessAgeID), this.DisID))
            {
                Response.Redirect("~/NoOperable.aspx");
                return;
            }
            suggest = new Hi.BLL.DIS_Suggest().GetModel(int.Parse(MessAgeID));
            if (suggest.IsAnswer != 0)
            {
                compuser = new Hi.BLL.SYS_Users().GetModel(suggest.CompUserID);
                if (suggest.IsAnswer == 1)
                {
                    suggest.IsAnswer   = 2;
                    suggest.modifyuser = this.DisID;
                    suggest.ts         = DateTime.Now;
                    new Hi.BLL.DIS_Suggest().Update(suggest);
                }
            }
            else
            {
                reply.Visible = false;
            }
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        user = this.CompUser;
        if (!IsPostBack)
        {
            this.txtPageSize.Value = PageSize.ToString();
            DataBinds();
            //if (!string.IsNullOrEmpty(Request["mszs"]) && Request["mszs"].ToString() == "1")
            //{
            //    ClientScript.RegisterStartupScript(page.GetType(), "msg", "<script>confirm('如果您的管理企业人员较少,请点击确认,或修改企业管理人员后点击下一步!', alinkorder, '提示');</script>");
            //}
            if (user.IsFirst == 0)
            {
                user.IsFirst    = 4;
                user.modifyuser = user.ID;
                user.ts         = DateTime.Now;
                new Hi.BLL.SYS_Users().Update(user);
            }
        }

        if (Request["nextstep"] != null && Request["nextstep"].ToString() == "1")
        {
            atitle.InnerText = "我要开通";
            //btitle.InnerText = "设置岗位权限";

            //下一步可用
            libtnNext.Style.Add("display", "block;");
            add.Style.Add("color", "black");
        }
    }
Beispiel #3
0
    public string PayableSum = string.Empty; //本月应款额

    protected void Page_Load(object sender, EventArgs e)
    {
        user  = new Hi.BLL.SYS_Users().GetModel(this.UserID);
        price = Convert.ToDecimal(new Hi.BLL.PAY_PrePayment().sums(user.DisID, user.CompID)).ToString("0.00");//(decimal)dt.Rows[0]["DisAccount"];
        if (user.IsFirst != 2)
        {
            if (user.IsFirst == 0)
            {
                if (user.UserPwd == Util.md5("123456"))
                {
                    JScript.AlertMethod(this, "经检测,您是第一次登录,为了您的账户安全,请先修改登录密码和支付密码!", JScript.IconOption.笑脸, "function (){ location.href = 'UserPWDEdit.aspx'; }");
                    return;
                }
                else
                {
                    user.IsFirst    = 1;
                    user.modifyuser = user.ID;
                    user.ts         = DateTime.Now;
                    new Hi.BLL.SYS_Users().Update(user);
                    JScript.AlertMethod(this, "经检测,您是第一次登录,为了您的账户安全,请修改支付密码!", JScript.IconOption.笑脸, "function (){ location.href = 'PayPWDEdit.aspx'; }");
                    return;
                }
            }
        }
        if (!IsPostBack)
        {
            InBind();
            Bind();
        }
    }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     user = new Hi.BLL.SYS_Users().GetModel(this.UserID);
     if (!IsPostBack)
     {
         txtpwd1.Value = "";
     }
 }
Beispiel #5
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction();

        Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
        if (Common.GetUserExists(txtUserName.Value.Trim()))
        {
            JScript.AlertMsg(this, "登录帐号已存在。");
            return;
        }
        if (Common.GetUserExists("Phone", txtUserPhone.Value.Trim()))
        {
            JScript.AlertMsg(this, "手机号码已存在。");
            return;
        }
        user.UserName     = Common.NoHTML(txtUserName.Value.Trim());
        user.TrueName     = Common.NoHTML(txtUserTrueName.Value.Trim());
        user.UserPwd      = Util.md5(txtUserPwd.Value.Trim());
        user.Phone        = Common.NoHTML(txtUserPhone.Value.Trim());
        user.AuditState   = 2;
        user.IsEnabled    = 1;
        user.CreateDate   = DateTime.Now;
        user.CreateUserID = UserID;
        user.ts           = DateTime.Now;
        user.modifyuser   = UserID;
        int userid = new Hi.BLL.SYS_Users().Add(user, Tran);

        Hi.Model.SYS_CompUser CompUser = new Hi.Model.SYS_CompUser();
        CompUser.CompID       = KeyID;
        CompUser.DisID        = 0;
        CompUser.CreateDate   = DateTime.Now;
        CompUser.CreateUserID = UserID;
        CompUser.modifyuser   = UserID;
        CompUser.CType        = 1;
        CompUser.UType        = 3;
        CompUser.IsEnabled    = 1;
        CompUser.IsAudit      = 2;
        CompUser.ts           = DateTime.Now;
        CompUser.dr           = 0;
        CompUser.UserID       = userid;
        CompUser.RoleID       = 0;
        new Hi.BLL.SYS_CompUser().Add(CompUser, Tran);
        //新增角色用户
        List <Hi.Model.SYS_Role> list = new Hi.BLL.SYS_Role().GetList("", "isnull(dr,0)=0 and IsEnabled=1 and CompID=" + KeyID + " and RoleName='企业管理员'", "");

        Hi.Model.SYS_RoleUser RoleUser = new Hi.Model.SYS_RoleUser();
        RoleUser.FunType    = 1;
        RoleUser.UserID     = userid;
        RoleUser.RoleID     = list[0].ID;
        RoleUser.IsEnabled  = true;
        RoleUser.CreateUser = this.UserID.ToString();
        RoleUser.CreateDate = DateTime.Now;
        RoleUser.ts         = DateTime.Now;
        RoleUser.dr         = 0;
        new Hi.BLL.SYS_RoleUser().Add(RoleUser, Tran);
        Tran.Commit();
        JScript.AlertMsgMo(this, "添加成功", "function(){ window.location.href=window.location.href; }");
    }
Beispiel #6
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
        int rolid = 0;

        if (Common.GetUserExists(txtUserName.Value.Trim()))
        {
            JScript.AlertMsg(this, "该用户已存在。");
            return;
        }
        if (!int.TryParse(HidRoid.Value, out rolid) || HidRoid.Value == "-1")
        {
            JScript.AlertMsg(this, "未选择岗位。");
            return;
        }
        if (Common.GetUserExists("Phone", txtUserPhone.Value.Trim()))
        {
            JScript.AlertMsg(this, "手机号码已存在。");
            return;
        }
        SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction();

        rolid             = HidRoid.Value.ToInt(0);
        user.UserName     = Common.NoHTML(txtUserName.Value.Trim());
        user.TrueName     = Common.NoHTML(txtTrueName.Value.Trim());
        user.UserPwd      = Util.md5(txtUserPwd.Value.Trim());
        user.Phone        = Common.NoHTML(txtUserPhone.Value.Trim());
        user.AuditState   = 2;
        user.IsEnabled    = 1;
        user.CreateDate   = DateTime.Now;
        user.CreateUserID = UserID;
        user.ts           = DateTime.Now;
        user.modifyuser   = UserID;
        int userid = new Hi.BLL.SYS_Users().Add(user, Tran);

        Hi.Model.SYS_CompUser CompUser = new Hi.Model.SYS_CompUser();
        CompUser.CompID       = TextComp.Compid.ToInt(0);
        CompUser.DisID        = 0;
        CompUser.CreateDate   = DateTime.Now;
        CompUser.CreateUserID = UserID;
        CompUser.modifyuser   = UserID;
        CompUser.CType        = 1;
        CompUser.UType        = 3;
        CompUser.IsEnabled    = 1;
        CompUser.IsAudit      = 2;
        CompUser.ts           = DateTime.Now;
        CompUser.dr           = 0;
        CompUser.UserID       = userid;
        CompUser.RoleID       = rolid;
        new Hi.BLL.SYS_CompUser().Add(CompUser, Tran);
        Tran.Commit();
        string str = string.Format("医站通提示:\n尊敬的用户您好,管理员给您创建了一个帐号为{0}的用户,请登录网站查看\n【医站通】", user.UserName);

        JScript.AlertMsgMo(this, "添加成功", "function(){ window.location.href='CompUserList.aspx?page=" + page + "'; }");
    }
Beispiel #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     user = new Hi.BLL.SYS_Users().GetModel(this.UserID);
     //if (user != null)
     //{
     if (!IsPostBack)
     {
         this.hidKeyID.Value = Request["KeyID"] + "";
         datatbind();
     }
     //}
 }
Beispiel #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            user = this.CompUser;

            if (user.UserPwd == Util.md5("123456"))
            {
                JScript.AlertMethod(this, "检测到您的登录密码为系统默认密码,请先修改您的登录密码!", JScript.IconOption.错误, "function(){location.href='ChangePwd.aspx?IsDpwd=1'}");
                return;
            }
        }
    }
Beispiel #9
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;
        }
    }
Beispiel #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Hi.Model.SYS_Users user = this.CompUser;
     if (Request["nextstep"] != null && Request["nextstep"].ToString() == "1")
     {
         atitle.InnerText = "我要开通";
         btitle.InnerText = "新增代理商";
     }
     if (user.IsFirst == 0)
     {
         user.IsFirst    = 4;
         user.modifyuser = user.ID;
         user.ts         = DateTime.Now;
         new Hi.BLL.SYS_Users().Update(user);
     }
 }
Beispiel #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     user = new Hi.BLL.SYS_Users().GetModel(this.UserID);
     dis  = new Hi.BLL.BD_Distributor().GetModel(this.DisID);
     if (Request["code"] != null)
     {
         Hi.Model.SYS_PhoneCode phonecode = new Hi.BLL.SYS_PhoneCode().GetModel("支付密码找回", user.Phone, Common.DesDecrypt(Request.QueryString["code"], Common.EncryptKey));
         if (phonecode == null)
         {
             Response.Redirect("PayPWDEdit.aspx", true);
         }
     }
     else
     {
         Response.Redirect("PayPWDEdit.aspx", true);
     }
 }
Beispiel #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Hi.Model.SYS_Users user = LoginModel.IsLoginAllUser();
         if (user != null)
         {
             txt_Phone.Value = user.Phone;
         }
         Compid          = 0;
         HidCompid.Value = Request["Comid"];
         //Title = ConfigurationManager.AppSettings["TitleName"].ToString() + " - 代理商加盟";
         LiteralJS.Text = " $.BindRegister(\"RegiDis\"," + 0 + ");" + (user == null ? "" : "$('#txt_Phone').trigger('blur');") + "";
         //操作日志统计开始
         Utils.WritePageLog(Request, "卖家注册");
         //操作日志统计结束
     }
 }
Beispiel #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Hi.Model.SYS_Users user = LoginModel.IsLoginAllUser();
            if (user != null)
            {
                txt_Phone.Value = user.Phone;
            }
            LiteralJS.Text = " $.BindRegister(\"RegiComp\");" + (user == null ? "" : "$('#txt_Phone').trigger('blur');") + "";
            if (!string.IsNullOrEmpty(Request["Comid"]))
            {
                Hi.Model.BD_Company Comp = new Hi.BLL.BD_Company().GetModel(Request["Comid"].ToInt(0));
                if (Comp == null)
                {
                    return;
                }
                else if (Comp.dr == 1)
                {
                    return;
                }
                else if (Comp.AuditState != 2)
                {
                    return;
                }
                else if (Comp.IsEnabled != 1)
                {
                    return;
                }

                Compid                = Comp.ID;
                HidCompid.Value       = Request["Comid"];
                CompDisName.InnerHtml = "代理商名称:";
                Title_type.InnerHtml  = Comp.CompName + " - 代理商加盟";
                //Title = ConfigurationManager.AppSettings["TitleName"].ToString() + " - 代理商加盟";
                LiteralJS.Text = " $.BindRegister(\"RegiDis\"," + Comp.ID + ");" + (user == null ? "" : "$('#txt_Phone').trigger('blur');") + "";
            }
            //操作日志统计开始
            Utils.WritePageLog(Request, "卖家注册");
            //操作日志统计结束
        }
    }
Beispiel #14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     user = new Hi.BLL.SYS_Users().GetModel(this.UserID);
     if (!string.IsNullOrEmpty(Request["type"]) && Request["type"].ToString() == "erphone" && !string.IsNullOrEmpty(Request["phone"]))
     {
         A_Erphone(Request["phone"].ToString());
     }
     if (!string.IsNullOrEmpty(Request["types"]) && Request["types"].ToString() == "aphone" && !string.IsNullOrEmpty(Request["phone"]))
     {
         AESPhone(Request["phone"].ToString());
     }
     if (!string.IsNullOrEmpty(Request["type"]) && Request["type"] == "hf")
     {
         afh.Visible = true;
     }
     else
     {
         afh.Visible = false;
     }
 }
Beispiel #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     user = new Hi.BLL.SYS_Users().GetModel(this.UserID);
     dis  = new Hi.BLL.BD_Distributor().GetModel(this.DisID);
     if (!IsPostBack)
     {
         if (Request.QueryString["type"] != null && Request.QueryString["type"].ToString() == "zhifu" && Request["ordid"] != null)
         {
             updatepay.Style["display"] = "none";
             PhonePay.Style["display"]  = "block";
             hidfh.Value = Request.QueryString["ordid"].ToString();
             OrderID     = Request.QueryString["ordid"].ToString();
         }
         if (Request.QueryString["type"] != null && Request.QueryString["type"] == "1")
         {
             A_Affirm();
         }
         if ((user.IsFirst == 0 || user.IsFirst == 1) && TypeID == 5)
         {
             paypwdli.Visible = false;
         }
     }
 }
Beispiel #16
0
    /// <summary>
    /// 获取修改登录密码,核心企业入驻的短信验证码
    /// </summary>
    /// <param name="JSon"></param>
    /// <param name="version"></param>
    /// <returns></returns>
    public ResultCaptcha GetCaptcha(string JSon, string version)
    {
        string phonenumb = string.Empty;
        string Type      = string.Empty;
        int    typeint   = 0;
        string typename  = string.Empty;
        string phonenum  = string.Empty;
        List <Hi.Model.SYS_Users> userList = null;

        Hi.BLL.SYS_Users bll_user = new Hi.BLL.SYS_Users();
        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["PhoneNumb"].ToString().Trim() != "" && JInfo["Type"].ToString().Trim() != "")
            {
                phonenumb = JInfo["PhoneNumb"].ToString();
                Type      = JInfo["Type"].ToString();
            }
            else
            {
                return(new ResultCaptcha()
                {
                    Result = "T", Description = "参数异常"
                });
            }
            #endregion
            //double loginnum = 0;
            //if (double.TryParse(phonenumb, out loginnum))//如果输入的登录名是整数,则先判断是否是手机号登录,不是手机号登录的话,再判断是否是账号名登录
            //{
            //    userList = bll_user.GetList("",
            //           "Phone = " + phonenumb + " and AuditState =2 and dr=0 and isnull(IsEnabled,0) =1", "");
            //}
            //if (userList == null || userList.Count <= 0)//不是手机号登录的话,再判断是不是账号名登录
            //{
            //    userList = bll_user.GetList("",
            //           "UserName = '******' and AuditState =2 and dr=0 and isnull(IsEnabled,0) =1", "");
            //    //如果两种情况都没找到,就是账号不存在
            //    if (userList == null || userList.Count <= 0)
            //        return new ResultCaptcha() { Result = "F", Description = "账号不存在" };
            //}
            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            switch (Type)
            {
            case "1":
                double loginnum = 0;
                if (double.TryParse(phonenumb, out loginnum))    //如果输入的登录名是整数,则先判断是否是手机号登录,不是手机号登录的话,再判断是否是账号名登录
                {
                    userList = bll_user.GetList("",
                                                "Phone = " + phonenumb + " and AuditState =2 and dr=0 and isnull(IsEnabled,0) =1", "");
                }
                if (userList == null || userList.Count <= 0)     //不是手机号登录的话,再判断是不是账号名登录
                {
                    userList = bll_user.GetList("",
                                                "UserName = '******' and AuditState =2 and dr=0 and isnull(IsEnabled,0) =1", "");
                    //如果两种情况都没找到,就是账号不存在
                    if (userList == null || userList.Count <= 0)
                    {
                        return new ResultCaptcha()
                               {
                                   Result = "F", Description = "账号不存在"
                               }
                    }
                    ;
                }
                user     = userList[0];
                typeint  = -5;
                typename = "修改登录密码";
                phonenum = user.Phone;
                break;

            case "2":
                //首先验证这手机号是否已经注册
                List <Hi.Model.SYS_Users> list_users = bll_user.GetList("",
                                                                        "Phone = " + phonenumb + " and AuditState =2 and dr=0 and isnull(IsEnabled,0) =1", "");
                //如果已经注册,就不发送验证码,并提示
                if (list_users != null && list_users.Count > 0)
                {
                    return new ResultCaptcha()
                           {
                               Result = "F", Description = "该手机号码已注册过账号,请使用未注册的手机号码注册"
                           }
                }
                ;
                typeint  = -10;
                typename = "核心企业注册";
                phonenum = phonenumb;
                break;

            default:
                return(new ResultCaptcha()
                {
                    Result = "F", Description = "操作类型不存在"
                });
            }
            //获取六位随机数
            string       PhoneCode    = new Common().CreateRandomCode(6);
            GetPhoneCode getphonecode = new GetPhoneCode();
            getphonecode.GetUser(
                System.Configuration.ConfigurationManager.AppSettings["PhoneCodeAccount"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["PhoneCodePwd"].ToString());
            //手机发送验证码
            string rstr = getphonecode.ReturnSTR(phonenum, PhoneCode);
            //信息发送成功的话需要在sys_phonecode表中插入一条数据
            if (rstr == "Success")
            {
                Hi.Model.SYS_PhoneCode phonecode = new Hi.Model.SYS_PhoneCode();
                phonecode.Type       = typeint;
                phonecode.Module     = typename;
                phonecode.Phone      = phonenum;
                phonecode.PhoneCode  = PhoneCode;
                phonecode.IsPast     = 0;
                phonecode.UserID     = user.ID;
                phonecode.UserName   = "";
                phonecode.CreateDate = DateTime.Now;
                phonecode.ts         = DateTime.Now;
                phonecode.modifyuser = user.ID;
                int i = new Hi.BLL.SYS_PhoneCode().Add(phonecode);
                if (i > 0)//新增成功的话拼接返回参数
                {
                    ResultCaptcha resultcaptcha = new ResultCaptcha();

                    resultcaptcha.Result      = "T";
                    resultcaptcha.Description = "返回成功";
                    resultcaptcha.SendId      = i.ToString();
                    resultcaptcha.Captcha     = PhoneCode;
                    resultcaptcha.PhoneNumb   = phonenum;
                    return(resultcaptcha);
                }
                else
                {
                    return(new ResultCaptcha()
                    {
                        Result = "F", Description = "验证码异常"
                    });
                }
            }
            else
            {
                return(new ResultCaptcha()
                {
                    Result = "F", Description = "发送失败 " + rstr
                });
            }
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetCaptcha:" + JSon);
            return(new ResultCaptcha()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
Beispiel #17
0
    /// <summary>
    /// 发送验证码
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public PhoneCode GetPhoneCode(string JSon)
    {
        try
        {
            string             disID      = string.Empty;
            string             userID     = string.Empty;
            string             type       = string.Empty;
            string             compID     = string.Empty;
            int                typeInt    = 0;
            string             Phone      = string.Empty;
            string             PhoneCode  = new Common().CreateRandomCode(6);
            Hi.Model.SYS_Users user       = null;
            Hi.Model.SYS_Users userMaster = null;

            #region 赋值、验证

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["Type"].ToString() != "" &&
                JInfo["ResellerID"].ToString() != "" && JInfo["CompanyID"].ToString() != "")
            {
                userID = JInfo["UserID"].ToString();
                type   = JInfo["Type"].ToString();
                disID  = JInfo["ResellerID"].ToString();
                compID = JInfo["CompanyID"].ToString();
            }
            else
            {
                return(new PhoneCode()
                {
                    Result = "F", Description = "参数不正确"
                });
            }

            if (!new Common().IsLegitUser(int.Parse(userID), out user, int.Parse(compID), int.Parse(disID == "" ? "0" : disID)))
            {
                return new PhoneCode()
                       {
                           Result = "F", Description = "登录信息异常"
                       }
            }
            ;
            if (disID != "")
            {
                userMaster = new Hi.BLL.SYS_Users().GetList("", " Type = 5 and compID='" + compID + "' and disID = '" + disID + "' and dr = 0 and IsEnabled = 1", "")[0];

                if (userMaster == null)
                {
                    return new PhoneCode()
                           {
                               Result = "F", Description = "经销商管理员异常"
                           }
                }
                ;
            }

            switch (type.Trim())
            {
            case "10":
                typeInt = 10;
                type    = "App企业钱包密码修改";
                Phone   = userMaster.Phone;
                break;

            case "11":
                typeInt = 11;
                type    = "App修改地址";
                Phone   = userMaster.Phone;
                break;

            case "12":
                typeInt = -1;
                type    = "App手机号码登录";
                Phone   = user.Phone;
                break;
            }

            #endregion

            GetPhoneCode getphonecode = new GetPhoneCode();
            getphonecode.GetUser(
                System.Configuration.ConfigurationManager.AppSettings["PhoneCodeAccount"].ToString(),
                System.Configuration.ConfigurationManager.AppSettings["PhoneCodePwd"].ToString());
            string rstr = getphonecode.ReturnSTR(Phone, PhoneCode);
            if (rstr == "Success")
            {
                Hi.Model.SYS_PhoneCode phonecode = new Hi.Model.SYS_PhoneCode();
                phonecode.Type       = typeInt;
                phonecode.Module     = type;
                phonecode.Phone      = Phone;
                phonecode.PhoneCode  = PhoneCode;
                phonecode.IsPast     = 0;
                phonecode.UserID     = int.Parse(userID);
                phonecode.UserName   = user.UserName;
                phonecode.CreateDate = DateTime.Now;
                phonecode.ts         = DateTime.Now;
                phonecode.modifyuser = int.Parse(userID);
                int i = new Hi.BLL.SYS_PhoneCode().Add(phonecode);
                if (i > 0)
                {
                    return(new PhoneCode()
                    {
                        Result = "T", Description = "发送成功", ChangePasswordID = i.ToString()
                    });
                }
                else
                {
                    return(new PhoneCode()
                    {
                        Result = "F", Description = "验证码异常"
                    });
                }
            }
            else
            {
                return(new PhoneCode()
                {
                    Result = "F", Description = "发送失败"
                });
            }
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetPhoneCode:" + JSon);
            return(new PhoneCode()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
Beispiel #18
0
    /// <summary>
    /// 根据验证码,修改密码
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public PhoneCode ChangePwdByCode(string JSon)
    {
        try
        {
            string UserID           = string.Empty;
            string disID            = string.Empty;
            string Type             = string.Empty;
            string Password         = string.Empty;
            string MessageCode      = string.Empty;
            string ChangePasswordID = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "" &&
                JInfo["Type"].ToString() != "" && JInfo["Password"].ToString() != "" &&
                JInfo["MessageCode"].ToString() != "" && JInfo["ChangePasswordID"].ToString() != "")
            {
                UserID           = JInfo["UserID"].ToString();
                Type             = JInfo["Type"].ToString();
                disID            = JInfo["ResellerID"].ToString();
                Password         = JInfo["Password"].ToString();
                MessageCode      = JInfo["MessageCode"].ToString();
                ChangePasswordID = JInfo["ChangePasswordID"].ToString();
            }
            else
            {
                return(new PhoneCode()
                {
                    Result = "F", Description = "参数不正确"
                });
            }

            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new PhoneCode()
                       {
                           Result = "F", Description = "登录信息异常"
                       }
            }
            ;

            Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(int.Parse(disID));
            if (dis == null)
            {
                return new PhoneCode()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;

            Hi.Model.SYS_PhoneCode code = new Hi.BLL.SYS_PhoneCode().GetModel(int.Parse(ChangePasswordID));
            if (code != null)
            {
                if (code.ts.AddMinutes(30) < DateTime.Now || code.IsPast == 1)
                {
                    return new PhoneCode()
                           {
                               Result = "F", Description = "验证码过期"
                           }
                }
                ;

                if (code.UserID.ToString() != UserID)
                {
                    return new PhoneCode()
                           {
                               Result = "F", Description = "非本人操作"
                           }
                }
                ;
                if (code.PhoneCode != MessageCode)
                {
                    return new PhoneCode()
                           {
                               Result = "F", Description = "验证码错误"
                           }
                }
                ;
            }
            else
            {
                return(new PhoneCode()
                {
                    Result = "F", Description = "验证码异常"
                });
            }
            dis.Paypwd     = new GetPhoneCode().md5(Password);
            dis.ts         = DateTime.Now;
            dis.modifyuser = user.ID;
            if (new Hi.BLL.BD_Distributor().Update(dis))
            {
                code.IsPast     = 1;
                code.ts         = DateTime.Now;
                code.modifyuser = user.ID;
                if (new Hi.BLL.SYS_PhoneCode().Update(code))
                {
                    return(new PhoneCode()
                    {
                        Result = "T", Description = "修改成功"
                    });
                }
                else
                {
                    return(new PhoneCode()
                    {
                        Result = "F", Description = "验证失败"
                    });
                }
            }
            return(new PhoneCode()
            {
                Result = "F", Description = "修改失败"
            });;
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "ChangePwdByCode:" + JSon);
            return(new PhoneCode()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
Beispiel #19
0
    /// <summary>
    /// 企业登录
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ResultCompLog CompanyLogin(string JSon)
    {
        try
        {
            #region JSon取值

            string LoginName  = string.Empty;
            string PassWord   = string.Empty;
            string AndroidKey = string.Empty;
            string IOSKey     = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["LoginName"].ToString() != "" && JInfo["PassWord"].ToString() != "")
            {
                LoginName = JInfo["LoginName"].ToString();

                PassWord = JInfo["PassWord"].ToString();
                //AndroidKey = JInfo["AndroidKey"].ToString();
                //IOSKey = JInfo["IOSKey"].ToString();
            }
            else
            {
                return(new ResultCompLog()
                {
                    Result = "F", Description = "参数为空异常"
                });
            }

            #endregion

            List <Hi.Model.SYS_Users> userList = new Hi.BLL.SYS_Users().GetList("",
                                                                                " UserName='******'", "");
            if (userList == null || userList.Count == 0)
            {
                return new ResultCompLog()
                       {
                           Result = "F", Description = "用户不存在"
                       }
            }
            ;
            if (userList.Count > 1)
            {
                return new ResultCompLog()
                       {
                           Result = "F", Description = "用户重名异常"
                       }
            }
            ;
            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            foreach (var auser in userList)
            {
                user = auser;
            }
            if (user.AuditState != 2)
            {
                return new ResultCompLog()
                       {
                           Result = "F", Description = "请等待审核通过"
                       }
            }
            ;
            if (user.dr == 1)
            {
                return new ResultCompLog()
                       {
                           Result = "F", Description = "用户已删除"
                       }
            }
            ;
            if (user.IsEnabled == 0)
            {
                return new ResultCompLog()
                       {
                           Result = "F", Description = "用户已禁用"
                       }
            }
            ;
            if (user.UserPwd != PassWord)
            {
                return new ResultCompLog()
                       {
                           Result = "F", Description = "登录密码不对"
                       }
            }
            ;
            if (user.Type != 3 && user.Type != 4)
            {
                return new ResultCompLog()
                       {
                           Result = "F", Description = "用户名或密码错误"
                       }
            }
            ;
            List <Hi.Model.SYS_CompUser> compUserList = new Hi.BLL.SYS_CompUser().GetList("",
                                                                                          "UserID='" + user.ID + "' and IsNull(dr,0)=0 ", "");
            return(null);

            //Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(user.CompID);
            //if (comp == null)
            //    return new ResultCompLog() {Result = "F", Description = "企业异常"};

            //return new ResultCompLog()
            //{
            //    Result = "T",
            //    Description = "登录成功",
            //    UserID = user.ID.ToString(),
            //    TrueName = user.TrueName,
            //    Sex = user.Sex,
            //    Phone = user.Phone,
            //    ConpamyID = user.CompID.ToString(),
            //    CompanyName = comp.CompName,
            //    IsEnabled = user.IsEnabled.ToString(),
            //    Erptype = comp.Erptype.ToString()
            //};
        }
        catch
        {
            Common.CatchInfo(JSon, "CompanyLogin");
            return(new ResultCompLog()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
Beispiel #20
0
    /// <summary>
    /// 查看是否启用微信支付或者支付宝支付
    /// </summary>
    public ResultPayInfo GetPayInfo(string JSon, string version)
    {
        string    disID           = string.Empty;
        string    UserID          = string.Empty;
        string    OrderType       = string.Empty;
        string    ReceiptNo       = string.Empty;
        string    PayPrice        = string.Empty;
        string    PayIDJSon       = string.Empty;
        string    partner         = string.Empty;
        string    seller          = string.Empty;
        string    private_key     = string.Empty;
        string    subject         = string.Empty; //提示内容
        string    GoodsName       = string.Empty; //订单所有商品的名称
        string    OrderNumberJSon = string.Empty; //订单支付流水号的json
        string    OrderNumber     = string.Empty; //订单支付流水号
        string    orderInfo       = string.Empty; //订单信息
        string    OrderCode       = string.Empty; //企业订单号
        DataTable dt_order        = null;


        Hi.BLL.BD_Distributor bll_dis   = new Hi.BLL.BD_Distributor();
        Hi.BLL.BD_Company     bll_comp  = new Hi.BLL.BD_Company();
        Hi.BLL.DIS_Order      bll_order = new Hi.BLL.DIS_Order();
        ResultPayInfo         payinfo   = new ResultPayInfo();
        Common comm = new Common();

        try
        {
            #region//JSon取值
            JsonData JInfo = null;
            JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString().Trim() != "" && JInfo["ResellerID"].ToString().Trim() != "" && JInfo["OrderType"].ToString().Trim() != "" &&
                JInfo["PayPrice"].ToString().Trim() != "" && JInfo["PayIDJson"].ToString().Trim() != "")
            {
                UserID = JInfo["UserID"].ToString();

                disID     = JInfo["ResellerID"].ToString();
                OrderType = JInfo["OrderType"].ToString();
                PayPrice  = JInfo["PayPrice"].ToString();
                PayIDJSon = JInfo["PayIDJson"].ToString();
            }
            else
            {
                return(new ResultPayInfo()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            if (OrderType == "0")
            {
                if (JInfo["ReceiptNo"].ToString().Trim() != "")
                {
                    ReceiptNo = JInfo["ReceiptNo"].ToString();
                }
                else
                {
                    return(new ResultPayInfo()
                    {
                        Result = "F", Description = "参数异常"
                    });
                }
            }
            #endregion

            //判断登录信息是否正确
            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new ResultPayInfo()
                       {
                           Result = "F", Description = "用户异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Distributor dis = bll_dis.GetModel(Convert.ToInt32(disID));
            if (dis == null || dis.dr == 1 || dis.AuditState == 0 || dis.IsEnabled == 0)
            {
                return new ResultPayInfo()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;
            //判断经销商对应的核心企业是否异常
            Hi.Model.BD_Company comp = bll_comp.GetModel(dis.CompID);
            if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            {
                return new ResultPayInfo()
                       {
                           Result = "F", Description = "核心企业异常"
                       }
            }
            ;
            //判断此订单的信息是否异常,是否可支付
            //根据订单号,取出订单数据放入dt中
            if (OrderType == "0")
            {
                dt_order = bll_order.GetData(ReceiptNo).Tables[0];

                if (Convert.ToInt32(dt_order.Rows[0]["OState"]) == (int)Enums.OrderState.待审核 ||
                    Convert.ToInt32(dt_order.Rows[0]["OState"]) == (int)Enums.OrderState.已作废 ||
                    Convert.ToInt32(dt_order.Rows[0]["PayState"]) == (int)Enums.PayState.已支付)
                {
                    return new ResultPayInfo()
                           {
                               Result = "F", Description = "订单信息异常"
                           }
                }
                ;
            }

            //获取Pay_PayWxandAli表的实体
            Hi.Model.Pay_PayWxandAli payali = Common.GetPayWxandAli(comp.ID);
            if (payali == null || ClsSystem.gnvl(payali.ali_isno, "0") == "0")
            {
                return new ResultPayInfo()
                       {
                           Result = "F", Description = "核心企业无可用的支付宝收款账户"
                       }
            }
            ;
            //对数据库中数据进行解密
            //partner = Common.DesDecrypt(payali.ali_partner, Common.EncryptKey);
            //seller = Common.DesDecrypt(payali.ali_seller_email, Common.EncryptKey);
            //private_key = Common.DesDecrypt(payali.ali_key, Common.EncryptKey);
            partner     = payali.ali_partner;
            seller      = payali.ali_seller_email;
            private_key = payali.ali_RSAkey;
            //订单支付跟预付款充值的提示信息(两种请款下的提示信息是不同的)
            if (OrderType == "0")
            {
                subject = "医站通订单-" + ReceiptNo;
            }
            else
            {
                subject = "医站通预付款充值";
            }
            //订单所有商品明细

            if (OrderType == "0")
            {
                DataTable l = new Hi.BLL.DIS_OrderDetail().GetOrderDe("", " IsNUll(o.dr,0)=0 and o.OrderId=" + Convert.ToInt32(dt_order.Rows[0]["ID"]));
                foreach (DataRow dr in l.Rows)
                {
                    GoodsName += dr["GoodsName"] + ",";
                }
                GoodsName = GoodsName.Substring(0, GoodsName.Length - 1);//去掉最后一个逗号
                if (GoodsName.Length > 15)
                {
                    GoodsName = GoodsName.Substring(0, 10) + "...";
                }
            }

            //获取订单支付时的支付流水号
            if (OrderType == "0")
            {
                OrderNumberJSon = new OrderPay().GetPayID(PayIDJSon);
                //解析返回的订单支付流水号的JSon
                JInfo = JsonMapper.ToObject(OrderNumberJSon);
                if (JInfo["Result"].ToString().Trim() == "F" || JInfo["PayNumb"].ToString().Trim() == "" || JInfo["Result"].ToString().Trim() == "" ||
                    JInfo["OrderCode"].ToString().Trim() == "")
                {
                    return(new ResultPayInfo()
                    {
                        Result = "F", Description = "获取支付流水号异常"
                    });
                }
                else
                {
                    OrderNumber = JInfo["PayNumb"].ToString();
                    OrderCode   = JInfo["OrderCode"].ToString();
                }
            }
            else//钱包充值时的流水号跟企业订单号
            {
                List <string> list = new List <string>();
                list        = Getpayidyfk(user.ID, comp.ID, dis.ID, PayPrice);
                OrderNumber = list[0];
                OrderCode   = list[1];
                if (OrderNumber == "" || OrderCode == "")
                {
                    return new ResultPayInfo()
                           {
                               Result = "F", Description = "获取支付流水号异常"
                           }
                }
                ;
            }
            //创建订单信息
            orderInfo = comm.getOrderInfo(subject, GoodsName, PayPrice, OrderNumber, partner, seller);
            // 对订单做RSA 签名
            //private_key = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANDptrV3pWWdbnr6wT8lPkZ6kbRgsjf8CfXpQNrJyOsmktOaX8DQRh5nd0lSFTtbfeGV4oWXi26bv+1Vt+CfAsYssf+futRj0l6Cxx0psJapK7QEXq3HqjB0tM11M9ym75WFFvTSZs1DysUkRV35g5rXuRtBOWR2sqm9JRAen+29AgMBAAECgYEAzZ+L1xb5c4e960uOE1Hb9tDDQs/9+j6XqzQ3QmFj4Zeo4p9KaeRVb62U6lThUvgdcYDuYWEkuuyPvtEk1/CKb61AvEW69ehwLeDXOy9AzEgQpGFPb1bgJ+kU8YCpgcOGR9G55iVc0ZW7B2iyx111Wvij8pc+A2ZeuByAG1f8PoECQQD7wvCyBJRNb7Gv7iHF+zx2lDxG6LTX2rCAZdr8FyWVjZEBfL6uPI+/2J2AqtFPaLa25+jQc3b74r4wuGKsvxBhAkEA1G4aDQovfB9RO/c4I+NX4mmitpNt66IuqKp0a9pOL/YfpNtr5GBgmK4LMVASqIG74bw5wAV7zJkunlGGPusK3QJBALLiUm/KvS1AXbqpsymfV9jRfvrLQiPVaW/x72ULdVMMIaoy3rGiqmkgGtlfhhWsS5cutMfYIwTamVS4zrP7lkECQFTvDJVoHCI5d0ZNivG2ZR4OdFMhURKkTpl7RX8V0qsUcgR9An9WFWkWNT1rMXqUHGWd100yJBRirqP4Hn+rhDUCQBPVgm4jNd5WjKD0Oj39FmF5D89OviTgQK4xYxYUIfqLBhuGZ3kWDvAmeE6uRgVXjQncv/c68W8pS2huT0syom4=";
            //private_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB";
            string sign = Com.Alipay.RSAFromPkcs8.sign(orderInfo, private_key, "utf-8");
            //string sign = RSAFromPkcs8.sign(orderInfo, private_key, "utf-8");
            sign = HttpUtility.UrlEncode(sign, Encoding.UTF8);
            //返回实体
            // 完整的符合支付宝参数规范的订单信息
            payinfo.Result      = "T";
            payinfo.Description = "返回成功";
            payinfo.InfoString  = orderInfo + "&sign=\"" + sign + "\"&"
                                  + comm.getSignType();
            payinfo.OrderCode = OrderCode;
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetPayInfo:" + JSon);
            return(new ResultPayInfo()
            {
                Result = "F", Description = "参数异常"
            });
        }
        return(payinfo);
    }
Beispiel #21
0
    public ResultAli Result_Ali(string JSon, string version)
    {
        string disID  = string.Empty;
        string UserID = string.Empty;

        Hi.BLL.BD_Distributor bll_dis  = new Hi.BLL.BD_Distributor();
        Hi.BLL.BD_Company     bll_comp = new Hi.BLL.BD_Company();
        ResultAli             result   = new ResultAli();
        string partner     = string.Empty;
        string seller      = string.Empty;
        string private_key = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString().Trim() != "" && JInfo["ResellerID"].ToString().Trim() != "")
            {
                disID = JInfo["ResellerID"].ToString();

                UserID = JInfo["UserID"].ToString();
            }
            else
            {
                return(new ResultAli()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            #endregion
            //判断登录信息是否正确
            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "用户异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Distributor dis = bll_dis.GetModel(Convert.ToInt32(disID));
            if (dis == null || dis.dr == 1 || dis.AuditState == 0 || dis.IsEnabled == 0)
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;
            //判断经销商对应的核心企业是否异常
            Hi.Model.BD_Company comp = bll_comp.GetModel(dis.CompID);
            if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "核心企业异常"
                       }
            }
            ;
            //获取Pay_PayWxandAli表的实体
            Hi.Model.Pay_PayWxandAli payali = Common.GetPayWxandAli(comp.ID);
            if (payali == null || ClsSystem.gnvl(payali.ali_isno, "0") == "0")
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "核心企业无可用的支付宝收款账户"
                       }
            }
            ;
            #region //返回参数

            result.Result      = "T";
            result.Description = "返回成功";
            //对数据库中数据进行解密
            partner     = Common.DesDecrypt(payali.ali_partner, Common.EncryptKey);
            seller      = Common.DesDecrypt(payali.ali_seller_email, Common.EncryptKey);
            private_key = Common.DesDecrypt(payali.ali_key, Common.EncryptKey);
            //对解密过的数据,再用我们的加密方法进行加密
            partner     = AESHelper.Encrpt_string(partner);
            seller      = AESHelper.Encrpt_string(seller);
            private_key = AESHelper.Encrpt_string(private_key);
            //将我们这边加密完的数据,赋值给返回实体
            result.PARTNER     = partner;
            result.SELLER      = seller;
            result.RSA_PRIVATE = private_key;
            #endregion
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "Result_Ali:" + JSon);
            return(new ResultAli()
            {
                Result = "F", Description = "参数异常"
            });
        }
        return(result);
    }
Beispiel #22
0
    /// <summary>
    /// 通过经销商ID获取绑定的企业
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ResultList GetResellerCompany(string JSon)
    {
        try
        {
            string   userID = string.Empty;
            string   disID  = string.Empty;
            JsonData JInfo  = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "")
            {
                if (JInfo["UserID"].ToString() != "")
                {
                    userID = JInfo["UserID"].ToString();
                }
                if (JInfo["ResellerID"].ToString() != "")
                {
                    disID = JInfo["ResellerID"].ToString();
                }
            }
            else
            {
                return(new ResultList()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(int.Parse(disID));
            if (dis == null || dis.dr == 1 || dis.IsEnabled == 0)
            {
                return new ResultList()
                       {
                           Result = "F", Description = "经销商信息异常"
                       }
            }
            ;

            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(userID), out user, 0, int.Parse(disID)))
            {
                return new ResultList()
                       {
                           Result = "F", Description = "登录信息异常"
                       }
            }
            ;

            string strWhere = " ID = '" + dis.CompID + "' and ISNULL(dr,0)=0 and IsEnabled = 1 ";
            List <Hi.Model.BD_Company> list = new Hi.BLL.BD_Company().GetList("", strWhere, "");
            if (list != null && list.Count > 0)
            {
                List <Company> compList = new List <Company>();

                foreach (Hi.Model.BD_Company comp in list)
                {
                    Company com = new Company();
                    com.CompanyID   = comp.ID;
                    com.CompanyName = comp.CompName;
                    compList.Add(com);
                }
                return(new ResultList()
                {
                    Result = "T",
                    Description = "获取成功",
                    CompanyList = compList
                });
            }
            else
            {
                return(new ResultList()
                {
                    Result = "T", Description = "未找到绑定企业"
                });
            }
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetResellerCompany :" + JSon);
            return(new ResultList()
            {
                Result = "F", Description = "异常"
            });
        }
    }
Beispiel #23
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hi.Model.SYS_Users model)
 {
     return(dal.Update(model));
 }
Beispiel #24
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hi.Model.SYS_Users model)
 {
     return(dal.Add(model));
 }
Beispiel #25
0
    public Dis_Order_Version3.ResultEdit UpGoodsPic(String JSon)
    {
        string UserID      = string.Empty;
        string CompID      = string.Empty;
        string StringImage = string.Empty;
        string FileName    = string.Empty;
        string GoodID      = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo["UserID"].ToString().Trim() == "" || JInfo["CompID"].ToString().Trim() == "" ||
                JInfo["StringImage"].ToString().Trim() == "" || JInfo["FileName"].ToString().Trim() == "" || JInfo["GoodID"].ToString().Trim() == "")
            {
                return(new Dis_Order_Version3.ResultEdit()
                {
                    Result = "F", Description = "参数异常"
                });
            }
            UserID      = JInfo["UserID"].ToString();
            CompID      = JInfo["CompID"].ToString();
            StringImage = JInfo["StringImage"].ToString();
            FileName    = Common.NoHTML(JInfo["FileName"].ToString());
            GoodID      = JInfo["GoodID"].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 Dis_Order_Version3.ResultEdit()
                {
                    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 Dis_Order_Version3.ResultEdit()
                       {
                           Result = "F", Description = "核心企业信息异常"
                       }
            }
            ;
            #endregion

            string ext = FileName.Substring(FileName.LastIndexOf("."));
            if (!(ext.ToUpper() == ".JPG" || ext.ToUpper() == ".PNG" || ext.ToUpper() == ".JPEG"))
            {
                return new Dis_Order_Version3.ResultEdit()
                       {
                           Result = "F", Description = "图片格式不正确"
                       }
            }
            ;
            string        ImgFolder = "GoodsImg/";
            string        name      = Guid.NewGuid().ToString() + ext;
            string        path      = GetWebConfigKey("ImgPath") + ImgFolder;
            string        viewPath  = GetWebConfigKey("ImgViewPath") + ImgFolder;
            DirectoryInfo di        = new DirectoryInfo(path);
            if (!di.Exists)
            {
                di.Create();
            }
            DirectoryInfo di2 = new DirectoryInfo(GetWebConfigKey("ImgPath") + "PicSpace/" + CompID);
            if (!di2.Exists)
            {
                di2.Create();
            }
            string     toFileName = name;
            string     saveFile   = path + "D" + toFileName;
            byte[]     b          = Convert.FromBase64String(StringImage);
            FileStream fs         = new FileStream(saveFile, FileMode.Create, FileAccess.Write);
            fs.Write(b, 0, b.Length);
            fs.Flush();
            fs.Close();

            ////单独保存图片
            string ThumbPath = GetWebConfigKey("ImgPath") + "PicSpace/" + CompID + "/" + FileName;
            //HttpFile.SaveAs(ThumbPath);
            //大缩略图
            string bigThumbPath = path + "X" + toFileName;
            MakeThumbnail(saveFile, bigThumbPath, 400, 400, "Cut");
            //小缩略图
            string smallThumbPath = path + toFileName;
            MakeThumbnail(saveFile, smallThumbPath, 200, 200, "Cut");

            FileStream fs1 = new FileStream(ThumbPath, FileMode.Create, FileAccess.Write);
            fs1.Write(b, 0, b.Length);
            fs1.Flush();
            fs1.Close();
            //新增一条BD_ImageList数据
            Hi.Model.BD_ImageList modelImg = new Hi.Model.BD_ImageList();
            modelImg.CompID       = comp.ID;
            modelImg.GoodsID      = Int32.Parse(GoodID);
            modelImg.Pic          = toFileName;
            modelImg.Pic2         = "X" + toFileName;
            modelImg.Pic3         = "D" + toFileName;
            modelImg.IsIndex      = 0;
            modelImg.CreateDate   = DateTime.Now;
            modelImg.CreateUserID = Int32.Parse(UserID);
            modelImg.ts           = DateTime.Now;
            modelImg.modifyuser   = Int32.Parse(UserID);
            if (new Hi.BLL.BD_ImageList().Add(modelImg) <= 0)
            {
                return new Dis_Order_Version3.ResultEdit()
                       {
                           Result = "F", Description = "图片上传失败"
                       }
            }
            ;
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "UpGoodsPic:" + JSon);
            return(new Dis_Order_Version3.ResultEdit()
            {
                Result = "F", Description = "图片上传失败"
            });
        }

        return(new Dis_Order_Version3.ResultEdit()
        {
            Result = "T", Description = "图片上传成功"
        });
    }
Beispiel #26
0
    public void btnAddList_Click(object sender, EventArgs e)
    {
        string         path  = "";
        int            count = 0;
        int            index = 0;
        SqlTransaction Tran  = null;

        try
        {
            if (FileUpload1.HasFile == false)//HasFile用来检查FileUpload是否有指定文件
            {
                JScript.AlertMsgOne(this, "请您选择代理商Excel模板文件", JScript.IconOption.错误);
                return;                                                                            //当无文件时,返回
            }
            string IsXls = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower(); //System.IO.Path.GetExtension获得文件的扩展名
            if (IsXls != ".xls" && IsXls != ".xlsx")
            {
                JScript.AlertMsgOne(this, "请您选择代理商Excel模板文件", JScript.IconOption.错误);
                return;//当选择的不是Excel文件时,返回
            }
            if (!Directory.Exists(Server.MapPath("TemplateFile")))
            {
                Directory.CreateDirectory(Server.MapPath("TemplateFile"));
            }
            string filename = FileUpload1.FileName;
            string name     = filename.Replace(IsXls, "");
            path = Server.MapPath("TemplateFile/") + name + "-" + DateTime.Now.ToString("yyyyMMddhhmmssffff") + IsXls;
            FileUpload1.SaveAs(path);
            DataTable dt = Common.ExcelToDataTable(path, TitleIndex);
            if (dt == null)
            {
                throw new Exception("Excel表中无数据");
            }
            if (dt.Rows.Count == 0)
            {
                throw new Exception("Excel表中无数据");
            }
            string    Discode     = string.Empty;
            string    DisName     = string.Empty;
            string    DisUserName = string.Empty;
            string    DisAddrees  = string.Empty;
            string    DisPerson   = string.Empty;
            string    DisPhone    = string.Empty;
            string    DisRemark   = string.Empty;
            string    Provice     = string.Empty;
            string    City        = string.Empty;
            string    Area        = string.Empty;
            string    DisCategory = string.Empty;
            string    DisLevel    = string.Empty;
            DataRow[] rows        = dt.Select();
            Tran       = DBUtility.SqlHelper.CreateStoreTranSaction();
            Eroor      = false;
            TitleError = string.Empty;
            foreach (DataRow row in rows)
            {
                int typeID = 0;
                int AreaID = 0;
                try
                {
                    //这个判断有bug呀,是遇到空行就停止的意思吗?
                    if (row["代理商名称 *\n(2-20个汉字或字母,推荐使用中文名称)"].ToString().Trim() == "" && row["管理员姓名 *\n(请填写真实姓名,以便更好地为您服务)"].ToString().Trim() == "" && row["详细地址 *\n(常用收货地址)"].ToString().Trim() == "")
                    {
                        break;
                    }
                    index++;
                    if (row["代理商名称 *\n(2-20个汉字或字母,推荐使用中文名称)"].ToString().Trim() == "示例代理商名称1" || row["代理商名称 *\n(2-20个汉字或字母,推荐使用中文名称)"].ToString().Trim() == "示例代理商名称2" || row["代理商名称 *\n(2-20个汉字或字母,推荐使用中文名称)"].ToString().Trim() == "示例代理商名称3")
                    {
                        continue;
                    }
                    DisName     = DisExistsAttribute("DisName", CheckDisLen(CheckVal(row["代理商名称 *\n(2-20个汉字或字母,推荐使用中文名称)"].ToString().Trim(), "代理商名称", index), index), "代理商名称", index, Tran);
                    DisPerson   = CheckVal(row["管理员姓名 *\n(请填写真实姓名,以便更好地为您服务)"].ToString().Trim(), "管理员姓名", index);
                    DisUserName = UserExistsAttribute("username", CheckVal(row["管理员登录帐号 *\n(2-20个文字、字母、数字,可以录入代理商姓名、简称等,一经设定无法更改,将来可用手机号进行登录)"].ToString().Trim(), "管理员登录帐号", index), "管理员登录帐号", index, Tran);
                    DisPhone    = CheckPhone(CheckVal(row["管理员手机 *\n(登录、发送验证短信)"].ToString().Trim(), "管理员手机", index), "管理员手机", index, Tran);
                    Provice     = CheckVal(row["所在省*"].ToString().Trim(), "省", index);
                    City        = CheckVal(row["所在市*"].ToString().Trim(), "市", index);
                    if (City.IndexOf("_") > 0)
                    {
                        City = City.Substring(City.IndexOf("_") + 1, City.Length - City.IndexOf("_") - 1);
                    }
                    Area        = CheckVal(row["所在区*"].ToString().Trim(), "区", index);
                    DisAddrees  = CheckVal(row["详细地址 *\n(常用收货地址)"].ToString().Trim(), "详细地址(常用收货地址)", index);
                    DisCategory = row["代理商分类"].ToString().Trim();
                    DisLevel    = row["代理商区域"].ToString().Trim();
                    bool disType = true;
                    if (!string.IsNullOrEmpty(DisCategory))
                    {
                        disType = CheckDisCategory(DisCategory, index, out typeID);
                    }
                    if (!string.IsNullOrEmpty(DisLevel))
                    {
                        CheckDisLevel(DisLevel, index, out AreaID);
                    }
                    DisRemark = row["备注"].ToString().Trim();
                    if (Eroor)
                    {
                        continue;
                    }
                }
                catch (Exception ex)
                {
                    if (ex is ApplicationException)
                    {
                        Eroor       = true;
                        TitleError += ex.Message;
                        continue;
                    }
                    else
                    {
                        throw new Exception("代理商Excel模版格式错误,请重新下载模版填入数据后导入。");
                    }
                }

                Hi.Model.BD_Distributor Dis = new Hi.Model.BD_Distributor();
                //Dis.DisCode = Discode;
                Dis.CompID       = CompID;
                Dis.DisName      = DisName;
                Dis.Province     = Provice;
                Dis.City         = City;
                Dis.Area         = Area;
                Dis.Address      = DisAddrees;
                Dis.Principal    = DisPerson;
                Dis.Phone        = DisPhone;
                Dis.DisTypeID    = typeID; //add by 2016.5.9
                Dis.AreaID       = AreaID; //add by 2016.5.10
                Dis.Remark       = DisRemark;
                Dis.IsCheck      = 0;
                Dis.CreditType   = 0; //不可以赊销
                Dis.Paypwd       = Util.md5("123456");
                Dis.IsEnabled    = 1;
                Dis.AuditState   = 2;
                Dis.CreateDate   = DateTime.Now;
                Dis.CreateUserID = UserID;
                Dis.ts           = DateTime.Now;
                Dis.modifyuser   = UserID;
                int disid = 0;
                if ((disid = new Hi.BLL.BD_Distributor().Add(Dis, Tran)) > 0)
                {
                    List <Hi.Model.SYS_Role> l = new Hi.BLL.SYS_Role().GetList("", "isnull(dr,0)=0 and isenabled=1 and DisID=" + disid + " and RoleName='企业管理员'", "", Tran);
                    if (l.Count == 0)
                    {
                        //新增角色(企业管理员)
                        Hi.Model.SYS_Role role = new Hi.Model.SYS_Role();
                        role.CompID       = CompID;
                        role.DisID        = disid;
                        role.RoleName     = "企业管理员";
                        role.IsEnabled    = 1;
                        role.SortIndex    = "1";
                        role.CreateDate   = DateTime.Now;
                        role.CreateUserID = UserID;
                        role.ts           = DateTime.Now;
                        role.modifyuser   = UserID;
                        role.dr           = 0;
                        int Roid = new Hi.BLL.SYS_Role().Add(role, Tran);
                        //新增管理员用户和角色
                        Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
                        user.UserName     = DisUserName;
                        user.Phone        = DisPhone;
                        user.TrueName     = DisPerson;
                        user.UserPwd      = Util.md5("123456");
                        user.IsEnabled    = 1;
                        user.AuditState   = 2;
                        user.CreateDate   = DateTime.Now;
                        user.CreateUserID = UserID;
                        user.ts           = DateTime.Now;
                        user.modifyuser   = UserID;
                        int AddUserid = new Hi.BLL.SYS_Users().Add(user, Tran);

                        ///用户明细表
                        Hi.Model.SYS_CompUser CompUser = new Hi.Model.SYS_CompUser();
                        CompUser.CompID       = CompID;
                        CompUser.DisID        = disid;
                        CompUser.CreateDate   = DateTime.Now;
                        CompUser.CreateUserID = UserID;
                        CompUser.modifyuser   = UserID;
                        CompUser.CType        = 2;
                        CompUser.UType        = 5;
                        CompUser.IsEnabled    = 1;
                        CompUser.IsAudit      = 2;
                        CompUser.RoleID       = Roid;
                        CompUser.ts           = DateTime.Now;
                        CompUser.dr           = 0;
                        CompUser.UserID       = AddUserid;
                        new Hi.BLL.SYS_CompUser().Add(CompUser, Tran);
                        //新增角色权限表   //暂时屏蔽下
                        Hi.Model.SYS_RoleSysFun    rolesys = null;
                        List <Hi.Model.SYS_SysFun> funList = new Hi.BLL.SYS_SysFun().GetList("", " Type=2", "", Tran);
                        foreach (Hi.Model.SYS_SysFun sys in funList)
                        {
                            rolesys              = new Hi.Model.SYS_RoleSysFun();
                            rolesys.CompID       = CompID;
                            rolesys.DisID        = disid;
                            rolesys.RoleID       = Roid;
                            rolesys.FunCode      = sys.FunCode;
                            rolesys.FunName      = sys.FunName;
                            rolesys.IsEnabled    = 1;
                            rolesys.CreateUserID = UserID;
                            rolesys.CreateDate   = DateTime.Now;
                            rolesys.ts           = DateTime.Now;
                            rolesys.modifyuser   = UserID;
                            new Hi.BLL.SYS_RoleSysFun().Add(rolesys, Tran);
                        }
                    }

                    Hi.Model.BD_DisAddr addr = new Hi.Model.BD_DisAddr();
                    addr.Province     = Provice;
                    addr.City         = City;
                    addr.Area         = Area;
                    addr.DisID        = disid;
                    addr.Principal    = DisPerson;
                    addr.Phone        = DisPhone;
                    addr.Address      = Provice + City + Area + DisAddrees;
                    addr.IsDefault    = 1;
                    addr.ts           = DateTime.Now;
                    addr.CreateDate   = DateTime.Now;
                    addr.CreateUserID = UserID;
                    addr.modifyuser   = UserID;
                    new Hi.BLL.BD_DisAddr().Add(addr, Tran);
                }
                else
                {
                    throw new ApplicationException("导入失败,服务器异常请重试。");
                }
                count++;
            }
            if (!Eroor)
            {
                Tran.Commit();
                if (Request["nextstep"] + "" == "1")
                {
                    JScript.AlertMethod(this, "导入成功,共导入" + count + "条代理商", JScript.IconOption.笑脸, "function(){  window.location.href=window.location.href+'?nextstep=1'; /* $(window.parent.leftFrame.document).find('.menuson li.active').removeClass('active');window.parent.leftFrame.document.getElementById('ktxzjxs').className = 'active';*/}");
                }
                else
                {
                    JScript.AlertMethod(this, "导入成功,共导入" + count + "条代理商", JScript.IconOption.笑脸, "function(){  window.location.href=window.location.href; }");
                }
            }
            else
            {
                Tran.Rollback();
                JScript.AlertMethod(this, TitleError, JScript.IconOption.错误, "function(){ addList(); }");
            }
        }
        catch (Exception ex)
        {
            if (Tran != null)
            {
                if (Tran.Connection != null)
                {
                    Tran.Rollback();
                }
            }
            JScript.AlertMethod(this, ex.Message, JScript.IconOption.错误, "function(){ $('a.bulk').trigger('click'); }");
        }
        finally
        {
            if (!string.IsNullOrEmpty(path))
            {
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
            }
        }
    }
Beispiel #27
0
    /// <summary>
    /// 修改密码
    /// </summary>
    /// <param name="JSon"></param>
    /// <param name="version"></param>
    /// <returns></returns>
    public ResultLoginCaptcha GetLoginCaptcha(string JSon, string version)
    {
        string phonenumb = string.Empty;
        string password  = string.Empty;
        string SendID    = string.Empty;
        string Captcha   = string.Empty;
        List <Hi.Model.SYS_Users> userList = new List <Hi.Model.SYS_Users>();

        Hi.BLL.SYS_Users bll_user = new Hi.BLL.SYS_Users();
        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["PhoneNumb"].ToString().Trim() != "" && JInfo["Pwd"].ToString().Trim() != "" &&
                JInfo["SendId"].ToString().Trim() != "" && JInfo["Captcha"].ToString().Trim() != "")
            {
                phonenumb = JInfo["PhoneNumb"].ToString();
                password  = JInfo["Pwd"].ToString();
                SendID    = JInfo["SendId"].ToString();
                Captcha   = JInfo["Captcha"].ToString();
            }
            else
            {
                return(new ResultLoginCaptcha()
                {
                    Result = "F", Description = "参数异常"
                });
            }
            #endregion
            #region
            //判断登录账号是否存在
            double loginnum = 0;
            //如果传入的登录账号是整数,先判断是否手机号登录
            if (double.TryParse(phonenumb, out loginnum))
            {
                userList = bll_user.GetList("",
                                            "Phone = " + phonenumb + " and AuditState =2 and dr=0 and isnull(IsEnabled,0) =1", "");
            }
            if (userList.Count <= 0)
            {
                userList = bll_user.GetList("",
                                            "UserName = '******' and AuditState =2 and dr=0 and isnull(IsEnabled,0) =1", "");
                //如果两种情况都没找到,就是账号不存在
                if (userList == null || userList.Count <= 0)
                {
                    return new ResultLoginCaptcha()
                           {
                               Result = "F", Description = "账号不存在"
                           }
                }
                ;
            }
            Hi.Model.SYS_Users user = userList[0];
            //验证验证码是否正确
            Hi.Model.SYS_PhoneCode code = new Hi.BLL.SYS_PhoneCode().GetModel(int.Parse(SendID));
            if (code != null && code.dr == 0)
            {
                if (code.ts.AddMinutes(30) < DateTime.Now || code.IsPast == 1)
                {
                    return new ResultLoginCaptcha()
                           {
                               Result = "F", Description = "验证码过期"
                           }
                }
                ;
                if (code.UserID.ToString() != user.ID.ToString())
                {
                    return new ResultLoginCaptcha()
                           {
                               Result = "F", Description = "非本人操作"
                           }
                }
                ;
                if (code.PhoneCode != Captcha)
                {
                    return new ResultLoginCaptcha()
                           {
                               Result = "F", Description = "验证码错误"
                           }
                }
                ;
            }
            else
            {
                return(new ResultLoginCaptcha()
                {
                    Result = "F", Description = "验证码不可用"
                });
            }
            if (user.UserPwd == new GetPhoneCode().md5(password))
            {
                return(new ResultLoginCaptcha()
                {
                    Result = "F", Description = "新密码不能与老密码相同"
                });
            }
            code.IsPast     = 1;
            code.ts         = DateTime.Now;
            code.modifyuser = user.ID;
            //更新sys_phonecode中此验证码的状态为已使用
            if (new Hi.BLL.SYS_PhoneCode().Update(code))
            {
                user.UserPwd    = new GetPhoneCode().md5(password);
                user.ts         = DateTime.Now;
                user.modifyuser = user.ID;
                //更新登录密码
                if (new Hi.BLL.SYS_Users().Update(user))
                {
                    return(new ResultLoginCaptcha()
                    {
                        Result = "T", Description = "修改成功"
                    });
                }
                else
                {
                    return(new ResultLoginCaptcha()
                    {
                        Result = "F", Description = "修改失败"
                    });
                }
            }
            else
            {
                return(new ResultLoginCaptcha()
                {
                    Result = "F", Description = "验证码异常"
                });
            }

            #endregion
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetLoginCaptcha:" + JSon);
            return(new ResultLoginCaptcha()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
Beispiel #28
0
    public ResultWX Result_WX(string JSon, string version)
    {
        string disID  = string.Empty;
        string UserID = string.Empty;

        Hi.BLL.BD_Distributor bll_dis  = new Hi.BLL.BD_Distributor();
        Hi.BLL.BD_Company     bll_comp = new Hi.BLL.BD_Company();
        ResultWX result = new ResultWX();
        string   appid  = string.Empty;
        string   mchid  = string.Empty;
        string   key    = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString().Trim() != "" && JInfo["ResellerID"].ToString().Trim() != "")
            {
                disID  = JInfo["ResellerID"].ToString();
                UserID = JInfo["UserID"].ToString();
            }
            else
            {
                return(new ResultWX()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            #endregion
            //判断登录信息是否正确
            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "用户异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Distributor dis = bll_dis.GetModel(Convert.ToInt32(disID));
            if (dis == null || dis.dr == 1 || dis.AuditState == 0 || dis.IsEnabled == 0)
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;
            //判断经销商对应的核心企业是否异常
            Hi.Model.BD_Company comp = bll_comp.GetModel(dis.CompID);
            if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "核心企业异常"
                       }
            }
            ;
            //获取Pay_PayWxandAli表的实体
            Hi.Model.Pay_PayWxandAli paywx = Common.GetPayWxandAli(comp.ID);
            if (paywx == null || ClsSystem.gnvl(paywx.wx_Isno, "0") == "0")
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "核心企业无可用的微信收款账户"
                       }
            }
            ;
            #region //返回参数
            result.Result      = "T";
            result.Description = "返回成功";
            //对数据库中取出的值进行解密
            appid = Common.DesDecrypt(paywx.wx_appid, Common.EncryptKey);
            mchid = Common.DesDecrypt(paywx.wx_mchid, Common.EncryptKey);
            key   = Common.DesDecrypt(paywx.wx_key, Common.EncryptKey);
            //对解密过的字段,用我们这边的方法重新加密
            appid = AESHelper.Encrpt_string(appid);
            mchid = AESHelper.Encrpt_string(mchid);
            key   = AESHelper.Encrpt_string(key);
            //将加密完的值赋给返回实体
            result.AppID = appid;
            result.Mchid = mchid;
            //result.AppSecret = paywx.wx_appsechet;
            result.APPkey = key;

            #endregion
            //return result;
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "Result_WX:" + JSon);
            return(new ResultWX()
            {
                Result = "F", Description = "参数异常"
            });
        }
        return(result);
    }
Beispiel #29
0
    /// <summary>
    /// 获取企业产品分类列表
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ResultGoodsCategory GetResellerProductClassifyList(string JSon)
    {
        try
        {
            string   userID    = string.Empty;
            string   disID     = string.Empty;
            string   companyID = string.Empty; //绑定的企业ID(目前只绑定一家,默认传入0)
            JsonData JInfo     = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "" &&
                JInfo["CompanyID"].ToString() != "")
            {
                userID    = JInfo["UserID"].ToString();
                disID     = JInfo["ResellerID"].ToString();
                companyID = JInfo["CompanyID"].ToString();
            }
            else
            {
                return(new ResultGoodsCategory()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(userID), out user, int.Parse(companyID), int.Parse(disID == "" ? "0" : disID)))
            {
                return new ResultGoodsCategory()
                       {
                           Result = "F", Description = "参数异常"
                       }
            }
            ;

            Hi.Model.BD_Company comp = new Hi.Model.BD_Company();
            if (companyID.Trim() == "0")//经销商分类:compID传0
            {
                Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(int.Parse(disID.Trim()));

                if (dis == null || dis.dr == 1 || dis.IsEnabled == 0)
                {
                    return new ResultGoodsCategory()
                           {
                               Result = "F", Description = "经销商信息异常"
                           }
                }
                ;
                comp = new Hi.BLL.BD_Company().GetModel(dis.CompID);
            }
            else //企业分类
            {
                comp = new Hi.BLL.BD_Company().GetModel(int.Parse(companyID.Trim()));
            }
            if (comp == null || comp.dr == 1 || comp.IsEnabled == 0)
            {
                return new ResultGoodsCategory()
                       {
                           Result = "T", Description = "企业异常"
                       }
            }
            ;



            string strsql = "select GoodsTypeID as ClassifyID, CategoryCode as ClassifyCode,CategoryName as ClassifyName,";
            strsql = strsql + "ParentID,SortIndex from BD_GoodsCategory ";
            strsql = strsql + "where CompID='" + comp.ID + "' and ISNULL(dr,0)=0 and IsEnabled = 1 ";
            DataTable dt = SqlAccess.ExecuteSqlDataTable(strsql, ConfigurationSettings.AppSettings["ConnectionString"].ToString());


            List <ProductClassify> pList = new List <ProductClassify>();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ProductClassify pClassifies = new ProductClassify();
                pClassifies.ClassifyID   = ClsSystem.gnvl(dt.Rows[i]["ClassifyID"], "");
                pClassifies.ClassifyName = ClsSystem.gnvl(dt.Rows[i]["ClassifyName"], "");
                pClassifies.ParentID     = ClsSystem.gnvl(dt.Rows[i]["ParentID"], "");
                pClassifies.SortIndex    = ClsSystem.gnvl(dt.Rows[i]["SortIndex"], "");
                pList.Add(pClassifies);
            }

            ProductClassify classifies = new ProductClassify();
            classifies.ClassifyID   = "-1";
            classifies.ClassifyName = "全部分类";
            classifies.ParentID     = "0";
            classifies.SortIndex    = "0";
            pList.Add(classifies);

            return(new ResultGoodsCategory()
            {
                Result = "T",
                Description = "获取成功",
                CompanyID = comp.ID.ToString(),
                CompanyName = comp.CompName,
                ProductClassifyList = pList
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetResellerProductClassifyList :" + JSon);
            return(new ResultGoodsCategory()
            {
                Result = "F", Description = "异常"
            });
        }
    }
Beispiel #30
0
    /// <summary>
    /// 获取某一分类产品信息,兼容了无属性的值,分类传-1
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public BD_GoodsCategory.ResultProductList GetProductsList(string JSon)
    {
        try
        {
            #region JSon取值

            string userID            = string.Empty;
            string disID             = string.Empty;
            string categoryID        = string.Empty; //分类ID
            string criticalProductID = string.Empty; //当前列表最临界点产品ID:初始-1
            string getType           = string.Empty; //方向
            string rows     = string.Empty;
            string sortType = string.Empty;
            string sort     = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "" &&
                JInfo["CriticalProductID"].ToString() != "" &&
                JInfo["GetType"].ToString() != "" && JInfo["Rows"].ToString() != "" &&
                JInfo["SortType"].ToString() != "" && JInfo["Sort"].ToString() != "")
            {
                userID            = JInfo["UserID"].ToString();
                disID             = JInfo["ResellerID"].ToString();
                categoryID        = JInfo["ClassifyID"].ToString();
                criticalProductID = JInfo["CriticalProductID"].ToString();
                getType           = JInfo["GetType"].ToString();
                rows     = JInfo["Rows"].ToString();
                sortType = JInfo["SortType"].ToString();
                sort     = JInfo["Sort"].ToString();
            }
            else
            {
                return(new BD_GoodsCategory.ResultProductList()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(userID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new BD_GoodsCategory.ResultProductList()
                       {
                           Result = "F", Description = "参数异常"
                       }
            }
            ;

            #endregion

            #region 模拟分页

            string strsql = string.Empty; //搜索sql
            Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(int.Parse(disID));
            if (dis == null || dis.dr == 1 || dis.IsEnabled == 0)
            {
                return new BD_GoodsCategory.ResultProductList()
                       {
                           Result = "F", Description = "未找到经销商"
                       }
            }
            ;
            const string tabName = " [dbo].[BD_Goods]";      //表名
            sortType = sortType == "2" ? "SalePrice" : "ID"; //价格排序
            string strWhere = string.Empty;

            switch (categoryID)
            {
            case "-2":     //促销列表
            {
                List <Hi.Model.BD_Promotion> promotionList = new Hi.BLL.BD_Promotion().GetList("",
                                                                                               " compID='" + dis.CompID + "' and ProStartTime<='" + DateTime.Now + "' and ProEndTime >='" +
                                                                                               DateTime.Now + "' and IsEnabled=1", "");
                List <Hi.Model.BD_PromotionDetail> detailList = new List <BD_PromotionDetail>();
                if (promotionList != null && promotionList.Count > 0)
                {
                    detailList = new Hi.BLL.BD_PromotionDetail().GetList("",
                                                                         " ProID in(" + string.Join(",", promotionList.Select(p => p.ID)) + ")", "");
                }
                if (promotionList == null)
                {
                    return new BD_GoodsCategory.ResultProductList()
                           {
                               Result = "F", Description = "今天无促销"
                           }
                }
                ;
                if (detailList == null)
                {
                    return new BD_GoodsCategory.ResultProductList()
                           {
                               Result = "F", Description = "今天无促销"
                           }
                }
                ;
                var ienum = detailList.Select(p => p.GoodsID);
                if (ienum.Count() > 0)
                {
                    strWhere += " and ID in ( " + string.Join(",", ienum) + ")";
                }
            }
            break;

            case "-3":     //收藏列表
            {
                List <Hi.Model.BD_DisCollect> collects = new Hi.BLL.BD_DisCollect().GetList("",
                                                                                            "disID='" + disID + "' and dr=0", "");
                if (collects != null)
                {
                    strWhere += " and ID not in ( -1 ";
                    strWhere  = collects.Aggregate(strWhere, (current, goods) => current + ("," + goods.GoodsID)) +
                                ")";
                }
            }
            break;

            default:
                if (categoryID != "-1")     //全部
                {
                    strWhere += " and CategoryID in (" + Common.AllCategory(int.Parse(categoryID)) + ")";
                }
                break;
            }

            //商品可售区域判断
            List <Common.GoodsID> list = Common.DisEnAreaGoodsID(disID, dis.CompID.ToString());
            if (list != null)
            {
                strWhere += " and ID not in ( -1 ";
                strWhere  = list.Aggregate(strWhere, (current, goods) => current + ("," + goods.goodsID)) + ")";
            }
            strWhere += " and ISNULL(dr,0)=0 and isoffline=1 and IsEnabled = 1 and compid=" + dis.CompID;

            strsql = new Common().PageSqlString(criticalProductID, "ID", tabName, sortType,
                                                sort, strWhere, getType, rows);

            #endregion

            List <Hi.Model.BD_DisCollect> Colist = Common.GetDataSource <BD_DisCollect>("",
                                                                                        " and disID='" + disID + "' and compID='" + dis.CompID + "' and IsEnabled =1");
            List <Hi.Model.BD_GoodsInfo> infoAllList = new Hi.BLL.BD_GoodsInfo().GetList("",
                                                                                         " CompID='" + dis.CompID + "' and ISNULL(dr,0)=0 and IsEnabled=1 and isoffline=1", "");

            #region 赋值

            int CategoryID = 0;

            List <BD_GoodsCategory.Product> ProductList = new List <BD_GoodsCategory.Product>();
            DataTable dsList = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql).Tables[0];
            if (dsList != null)
            {
                if (dsList.Rows.Count == 0)
                {
                    return new BD_GoodsCategory.ResultProductList()
                           {
                               Result = "F", Description = "未找到数据"
                           }
                }
                ;
                foreach (DataRow row in dsList.Rows)
                {
                    string SKUName = string.Empty;

                    BD_GoodsCategory.Product product = new BD_GoodsCategory.Product();
                    product.ProductID   = row["ID"].ToString(); //商品ID
                    product.ProductName = row["GoodsName"].ToString();
                    SKUName            += product.ProductName;
                    product.SalePrice   = decimal.Parse(row["SalePrice"].ToString()).ToString("0.00");
                    product.IsSale      = row["IsSale"].ToString();

                    List <Hi.Model.BD_DisCollect> alist = Colist != null && Colist.Count > 0
                        ? Colist.Where(p => p.GoodsID.ToString() == product.ProductID).ToList()
                        : null;
                    product.IsCollect = alist != null && alist.Count > 0 ? "1" : "0";
                    product.Title     = row["Title"].ToString();
                    //product.Details = row["Details"].ToString();
                    product.Title      = row["Title"].ToString();
                    product.Unit       = row["Unit"].ToString();
                    product.ClassifyID = row["CategoryID"].ToString();
                    CategoryID         = int.Parse(row["CategoryID"].ToString()); //类别ID

                    List <BD_GoodsCategory.Pic> Pic = new List <BD_GoodsCategory.Pic>();

                    #region List<Pic> Pic

                    if (row["Pic"].ToString() != "" && row["Pic"].ToString() != "X")
                    {
                        BD_GoodsCategory.Pic pic = new BD_GoodsCategory.Pic();
                        pic.ProductID = row["ID"].ToString();
                        pic.IsDeafult = "1";
                        pic.PicUrl    = ConfigurationManager.AppSettings["ImgViewPath"].ToString().Trim() + "GoodsImg/" +
                                        row["Pic"].ToString();
                        Pic.Add(pic);
                    }

                    Pic.AddRange(GetPicList(row["ID"].ToString()));

                    #endregion

                    product.ProductPicUrlList = Pic;

                    List <BD_GoodsCategory.SKU> SKUList = new List <BD_GoodsCategory.SKU>();
                    string strID = "0";

                    #region 通过 商品ID和属性值ID关联表,找到属性值

                    List <Hi.Model.BD_GoodsInfo> goodsInfoList = infoAllList != null && infoAllList.Count > 0
                        ? infoAllList.Where(p => p.GoodsID.ToString() == row["ID"].ToString()).ToList()
                        : null;
                    foreach (Hi.Model.BD_GoodsInfo goodsInfo in goodsInfoList)
                    {
                        if (!Common.IsOffline(goodsInfo.ID))
                        {
                            continue;
                        }

                        BD_GoodsCategory.SKU SKU = new BD_GoodsCategory.SKU();
                        //SKUID是GoodsInfoID,SKUName是GoodsName+各种属性值
                        SKU.SKUID     = goodsInfo.ID.ToString();
                        SKU.ProductID = goodsInfo.GoodsID.ToString();
                        SKU.BarCode   = goodsInfo.BarCode;
                        //SKUName = GoodsName + ValueInfo
                        SKU.SKUName = SKUName + " " + goodsInfo.ValueInfo;

                        SKU.ValueInfo = goodsInfo.ValueInfo;
                        SKU.SalePrice = goodsInfo.SalePrice.ToString("0.00");

                        int ProID = 0;   //暂时未用到 促销ID
                        SKU.IsPro = "0"; //默认不是促销价
                        decimal price = Common.GetProPrice(goodsInfo.GoodsID.ToString(), goodsInfo.ID.ToString(),
                                                           goodsInfo.CompID.ToString(), out ProID);
                        if (price == 0)
                        {
                            List <Hi.Model.BD_GoodsPrice> goodsPrice = new Hi.BLL.BD_GoodsPrice().GetList("",
                                                                                                          " GoodsInfoID='" + goodsInfo.ID + "' and ISNULL(dr,0)=0 and compid='" + goodsInfo.CompID +
                                                                                                          "' and IsEnabled=1", "");
                            SKU.TinkerPrice = goodsPrice.Count != 0
                                ? goodsPrice[0].TinkerPrice.ToString("0.00")
                                : goodsInfo.TinkerPrice.ToString("0.00");
                        }
                        else
                        {
                            SKU.IsPro       = "1"; //是促销价
                            SKU.ProInfo     = GetProInfo(ProID, goodsInfo.ID);
                            SKU.TinkerPrice = price.ToString("0.00");
                        }


                        List <BD_GoodsCategory.ProductAttValueID> ProductAttValueIDList = new List <BD_GoodsCategory.ProductAttValueID>();

                        List <Hi.Model.BD_GoodsAttrsInfo> attrList = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", " GoodsID='" + goodsInfo.GoodsID + "' and ISNULL(dr,0)=0", "");
                        if (attrList == null)
                        {
                            return new BD_GoodsCategory.ResultProductList()
                                   {
                                       Result = "F", Description = "未找到商品属性名字"
                                   }
                        }
                        ;
                        List <Hi.Model.BD_GoodsAttrs> attrValList = new Hi.BLL.BD_GoodsAttrs().GetList("*", " CompID ='" + dis.CompID + "'", "");
                        foreach (Hi.Model.BD_GoodsAttrsInfo attribute in attrList)
                        {
                            strID += "," + attribute.AttrsID;

                            string[] args  = new[] { goodsInfo.ValueInfo };
                            string[] items = args[0].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                            foreach (string item in items)
                            {
                                string[] strs = item.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

                                if (strs[1] == attribute.AttrsInfoName)
                                {
                                    BD_GoodsCategory.ProductAttValueID productAttValueID = new BD_GoodsCategory.ProductAttValueID()
                                    {
                                        ProductAttributeValueID = attribute.ID.ToString()//
                                    };
                                    ProductAttValueIDList.Add(productAttValueID);
                                }
                            }
                        }

                        SKU.ProductAttValueIDList = ProductAttValueIDList;
                        SKUList.Add(SKU);
                    }

                    #endregion

                    product.SKUList = SKUList;

                    List <BD_GoodsCategory.ProductAttribute> ProductAttributeList = new List <BD_GoodsCategory.ProductAttribute>();

                    #region 通过商品类别ID和属性ID关联表,找到属性ID

                    List <Hi.Model.BD_GoodsAttrs> val = new Hi.BLL.BD_GoodsAttrs().GetList("", " ID in (" + strID + ") and CompID='" + dis.CompID + "' and ISNULL(dr,0)=0", "");
                    if (val == null)
                    {
                        return new BD_GoodsCategory.ResultProductList()
                               {
                                   Result = "F", Description = "未找到商品属性"
                               }
                    }
                    ;

                    foreach (Hi.Model.BD_GoodsAttrs goodsAttr in val)
                    {
                        BD_GoodsCategory.ProductAttribute proAttr = new BD_GoodsCategory.ProductAttribute();

                        proAttr.ProductID            = row["ID"].ToString();
                        proAttr.ProductAttributeID   = goodsAttr.ID.ToString(); //属性ID
                        proAttr.ProductAttributeName = goodsAttr.AttrsName;     //属性名称

                        List <BD_GoodsCategory.ProductAttValue> ProductAttValueList = new List <BD_GoodsCategory.ProductAttValue>();

                        List <Hi.Model.BD_GoodsAttrsInfo> attrList = new Hi.BLL.BD_GoodsAttrsInfo().GetList("",
                                                                                                            " AttrsID='" + goodsAttr.ID + "' and CompID='" + dis.CompID + "' and ISNULL(dr,0)=0" +
                                                                                                            " and AttrsID in (" + strID + ")", "ID"); //todo:商品属性表修改咨询商品结构
                        if (attrList == null)
                        {
                            return new BD_GoodsCategory.ResultProductList()
                                   {
                                       Result = "F", Description = "未找到商品属性名字"
                                   }
                        }
                        ;
                        foreach (Hi.Model.BD_GoodsAttrsInfo attribute in attrList)
                        {
                            BD_GoodsCategory.ProductAttValue productAttValue = new BD_GoodsCategory.ProductAttValue();

                            productAttValue.ProductID           = row["ID"].ToString();
                            productAttValue.ProductAttributeID  = goodsAttr.ID.ToString();
                            productAttValue.ProductAttValueID   = attribute.ID.ToString();
                            productAttValue.ProductAttValueName = attribute.AttrsInfoName;

                            ProductAttValueList.Add(productAttValue);
                        }
                        proAttr.ProductAttValueList = ProductAttValueList;
                        ProductAttributeList.Add(proAttr);
                    }

                    #endregion

                    product.ProductAttributeList = ProductAttributeList;

                    ProductList.Add(product);
                }
            }

            #endregion

            return(new BD_GoodsCategory.ResultProductList()
            {
                Result = "T",
                Description = "获取成功",
                ClassifyID = categoryID,
                ProductList = ProductList
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetResellerProductList :" + JSon);
            return(new BD_GoodsCategory.ResultProductList()
            {
                Result = "F", Description = "异常"
            });
        }
    }