Exemple #1
0
        private void btnCreate_Click(object sender, System.EventArgs e)
        {
            string     str;
            ConfigData data;
            decimal    num;

            if (this.ValidateValues(out str, out data, out num))
            {
                PaymentModeInfo paymentMode = new PaymentModeInfo
                {
                    Name               = this.txtName.Text,
                    Description        = this.fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""),
                    Gateway            = str,
                    IsUseInpour        = this.radiIsUseInpour.SelectedValue,
                    IsUseInDistributor = this.radiIsUseInDistributor.SelectedValue,
                    Charge             = num,
                    IsPercent          = this.chkIsPercent.Checked,
                    Settings           = HiCryptographer.Encrypt(data.SettingsXml)
                };
                switch (SalesHelper.CreatePaymentMode(paymentMode))
                {
                case PaymentModeActionStatus.Success:
                    base.Response.Redirect(Globals.GetAdminAbsolutePath("sales/PaymentTypes.aspx"));
                    break;

                case PaymentModeActionStatus.DuplicateName:
                    this.ShowMsg("已经存在一个相同的支付方式名称", false);
                    break;

                case PaymentModeActionStatus.OutofNumber:
                    this.ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                    break;

                case PaymentModeActionStatus.DuplicateGateway:
                    this.ShowMsg("已经添加了一个相同类型的支付接口", false);
                    break;

                default:
                    this.ShowMsg("未知错误", false);
                    break;
                }
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);

            if (!base.IsPostBack)
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                this.radEnableAppWxPay.SelectedValue = masterSettings.EnableAppWxPay;

                PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("Ecdev.plugins.payment.WxpayQrCode.QrCodeRequest");

                if (paymentMode != null)
                {
                    this.txtAppId.Text     = "";
                    this.txtAppSecret.Text = "";
                    this.txtMchId.Text     = "";
                    this.txtKey.Text       = "";

                    if (paymentMode.Settings != "")
                    {
                        string xml = HiCryptographer.Decrypt(paymentMode.Settings);

                        try
                        {
                            System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
                            xmlDocument.LoadXml(xml);

                            this.txtAppId.Text     = xmlDocument.GetElementsByTagName("AppId")[0].InnerText;
                            this.txtKey.Text       = xmlDocument.GetElementsByTagName("Key")[0].InnerText;
                            this.txtAppSecret.Text = xmlDocument.GetElementsByTagName("AppSecret")[0].InnerText;
                            this.txtMchId.Text     = xmlDocument.GetElementsByTagName("MchId")[0].InnerText;
                        }
                        catch
                        {
                            this.txtAppId.Text     = "";
                            this.txtKey.Text       = "";
                            this.txtAppSecret.Text = "";
                            this.txtMchId.Text     = "";
                        }
                    }
                }
            }
        }
        private void DoValidate()
        {
            NameValueCollection values2 = new NameValueCollection();

            values2.Add(this.Page.Request.Form);
            values2.Add(this.Page.Request.QueryString);
            NameValueCollection parameters = values2;

            this.Gateway = "hishop.plugins.payment.ws_wappay.wswappayrequest";
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
            if (this.isBackRequest)
            {
                this.Notify.ReturnUrl = Globals.FullPath("/pay/PaymentReturn_url.aspx") + "?" + this.Page.Request.Url.Query;
            }
            this.OrderId = this.Notify.GetOrderId();
            this.Order   = ShoppingProcessor.GetOrderInfo(this.OrderId);
            if (this.Order == null)
            {
                this.ResponseStatus(true, "ordernotfound");
            }
            else
            {
                this.Amount = this.Notify.GetOrderAmount();
                if (this.Amount <= 0M)
                {
                    this.Amount = this.Order.GetTotal();
                }
                this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId();
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(this.Order.PaymentTypeId);
                if (paymentMode == null)
                {
                    this.ResponseStatus(true, "gatewaynotfound");
                }
                else
                {
                    this.Notify.Finished          += new EventHandler <FinishedEventArgs>(this.Notify_Finished);
                    this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild);
                    this.Notify.Payment           += new EventHandler(this.Notify_Payment);
                    this.Notify.VerifyNotify(0x7530, HiCryptographer.Decrypt(paymentMode.Settings));
                }
            }
        }
Exemple #4
0
        private void btnAdminLogin_Click(object sender, EventArgs e)
        {
            if (!Globals.CheckVerifyCode(this.txtCode.Text.Trim()))
            {
                this.ShowMessage("验证码不正确");
            }
            else
            {
                ManagerInfo manager = ManagerHelper.GetManager(this.txtAdminName.Text);
                if (manager == null)
                {
                    this.ShowMessage("无效的用户信息");
                }
                else if (manager.Password != HiCryptographer.Md5Encrypt(this.txtAdminPassWord.Text))
                {
                    this.ShowMessage("密码不正确");
                }
                else
                {
                    HttpCookie cookie = new HttpCookie("Vshop-Manager")
                    {
                        Value   = manager.UserId.ToString(),
                        Expires = DateTime.Now.AddDays(1.0)
                    };
                    HttpContext.Current.Response.Cookies.Add(cookie);

                    //Model.manager model = Session[DTKeys.SESSION_ADMIN_INFO] as Model.manager;
                    //Model.manager model = (Model.manager)Session[DTKeys.SESSION_ADMIN_INFO];
                    Session[DTKeys.SESSION_ADMIN_INFO] = manager;

                    if (manager.RoleId == 1)
                    {
                        //this.Page.Response.Redirect("/admin/Default.aspx", true);
                        this.Page.Response.Redirect("/admin/business/index.aspx");
                    }
                    else //if(manager.RoleId == 2)
                    {
                        this.Page.Response.Redirect("/admin/business/frame.aspx", true);
                    }
                }
            }
        }
Exemple #5
0
 private void DoValidate()
 {
     System.Collections.Specialized.NameValueCollection parameters = new System.Collections.Specialized.NameValueCollection
     {
         this.Page.Request.Form,
         this.Page.Request.QueryString
     };
     this.Gateway = this.Page.Request.QueryString["HIGW"];
     this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
     if (this.isBackRequest)
     {
         this.Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorInpourReturn_url", new object[]
         {
             this.Gateway
         }));
         PaymentNotify expr_AC = this.Notify;
         expr_AC.ReturnUrl = expr_AC.ReturnUrl + "?" + this.Page.Request.Url.Query;
     }
     this.InpourId      = this.Notify.GetOrderId();
     this.Amount        = this.Notify.GetOrderAmount();
     this.InpourRequest = SubsiteStoreHelper.GetInpouRequest(this.InpourId);
     if (this.InpourRequest == null)
     {
         this.ResponseStatus(true, "success");
     }
     else
     {
         this.Amount  = this.InpourRequest.InpourBlance;
         this.paymode = SubsiteStoreHelper.GetPaymentMode(this.InpourRequest.PaymentId);
         if (this.paymode == null)
         {
             this.ResponseStatus(true, "gatewaynotfound");
         }
         else
         {
             this.Notify.Finished          += new System.EventHandler <FinishedEventArgs>(this.Notify_Finished);
             this.Notify.NotifyVerifyFaild += new System.EventHandler(this.Notify_NotifyVerifyFaild);
             this.Notify.Payment           += new System.EventHandler(this.Notify_Payment);
             this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(this.paymode.Settings));
         }
     }
 }
Exemple #6
0
        private int GetUserId()
        {
            HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["PC-Member"];

            if (httpCookie == null)
            {
                httpCookie = HiContext.Current.Context.Request.Cookies["Shop-Member"];
                if (httpCookie == null)
                {
                    goto IL_0057;
                }
            }
            goto IL_0057;
IL_0057:
            if (httpCookie != null)
            {
                try
                {
                    return(int.Parse(HiCryptographer.Decrypt(httpCookie.Value)));
                }
                catch (Exception ex)
                {
                    NameValueCollection nameValueCollection = new NameValueCollection
                    {
                        base.Request.QueryString,
                        base.Request.Form
                    };
                    nameValueCollection.Add("UserCookie", httpCookie.Value);
                    if (ex.Message.IndexOf("填充无效,无法被移除") > -1)
                    {
                        httpCookie.Expires = DateTime.Now.AddDays(-1.0);
                        HttpContext.Current.Response.Cookies.Add(httpCookie);
                    }
                    else
                    {
                        Globals.WriteExceptionLog_Page(ex, nameValueCollection, "GetUserIdEx");
                    }
                    return(0);
                }
            }
            return(0);
        }
Exemple #7
0
        private void DoValidate()
        {
            NameValueCollection values2 = new NameValueCollection();

            values2.Add(this.Page.Request.Form);
            values2.Add(this.Page.Request.QueryString);
            NameValueCollection parameters = values2;

            this.Gateway = this.Page.Request.QueryString["HIGW"];
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
            if (this.isBackRequest)
            {
                this.Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { this.Gateway })) + "?" + this.Page.Request.Url.Query;
            }
            this.OrderId = this.Notify.GetOrderId();
            this.Order   = TradeHelper.GetOrderInfo(this.OrderId);
            if (this.Order == null)
            {
                this.ResponseStatus(true, "ordernotfound");
            }
            else
            {
                this.Amount = this.Notify.GetOrderAmount();
                if (this.Amount <= 0M)
                {
                    this.Amount = this.Order.GetTotal();
                }
                this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId();
                PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(this.Order.PaymentTypeId);
                if (paymentMode == null)
                {
                    this.ResponseStatus(true, "gatewaynotfound");
                }
                else
                {
                    this.Notify.Finished          += new EventHandler <FinishedEventArgs>(this.Notify_Finished);
                    this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild);
                    this.Notify.Payment           += new EventHandler(this.Notify_Payment);
                    this.Notify.VerifyNotify(0x7530, HiCryptographer.Decrypt(paymentMode.Settings));
                }
            }
        }
Exemple #8
0
        private void DoValidate()
        {
            NameValueCollection values2 = new NameValueCollection();

            values2.Add(this.Page.Request.Form);
            values2.Add(this.Page.Request.QueryString);
            NameValueCollection parameters = values2;

            this.Gateway = "hishop.plugins.payment.ws_wappay.wswappayrequest";
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
            Globals.Debuglog("订单支付:0-" + JsonConvert.SerializeObject(this.Notify), "_Debuglog.txt");
            if (this.isBackRequest)
            {
                this.Notify.ReturnUrl = Globals.FullPath("/pay/PaymentReturn_url.aspx") + "?" + this.Page.Request.Url.Query;
            }
            Globals.Debuglog("订单支付:1-" + JsonConvert.SerializeObject(this.Notify), "_Debuglog.txt");
            this.OrderId   = this.Notify.GetOrderId();
            this.orderlist = ShoppingProcessor.GetOrderMarkingOrderInfo(this.OrderId);
            if (this.orderlist.Count != 0)
            {
                int modeId = 0;
                foreach (OrderInfo info in this.orderlist)
                {
                    this.Amount        += info.GetAmount();
                    info.GatewayOrderId = this.Notify.GetGatewayOrderId();
                    modeId = info.PaymentTypeId;
                }
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                if (paymentMode == null)
                {
                    this.ResponseStatus(true, "gatewaynotfound");
                }
                else
                {
                    this.Notify.Finished          += new EventHandler <FinishedEventArgs>(this.Notify_Finished);
                    this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild);
                    this.Notify.Payment           += new EventHandler(this.Notify_Payment);
                    string configXml = HiCryptographer.Decrypt(paymentMode.Settings);
                    this.Notify.VerifyNotify(0x7530, configXml);
                }
            }
        }
        protected override void Render(HtmlTextWriter writer)
        {
            IList <PaymentModeInfo> paymentModes = ShoppingProcessor.GetPaymentModes();
            StringBuilder           builder      = new StringBuilder();

            builder.Append("<button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">请选择一种支付方式<span class=\"caret\"></span></button>");
            builder.AppendLine("<ul id=\"selectPaymentType\" class=\"dropdown-menu\" role=\"menu\">");
            if (SettingsManager.GetMasterSettings(false).EnableWeiXinRequest)
            {
                builder.AppendLine("<li><a href=\"#\" name=\"88\">微信支付</a></li>");
            }
            if (SettingsManager.GetMasterSettings(false).EnableOffLineRequest)
            {
                builder.AppendLine("<li><a href=\"#\" name=\"99\">线下付款</a></li>");
            }
            if (SettingsManager.GetMasterSettings(false).EnablePodRequest)
            {
                builder.AppendLine("<li><a href=\"#\" name=\"0\">货到付款</a></li>");
            }
            if ((paymentModes != null) && (paymentModes.Count > 0))
            {
                foreach (PaymentModeInfo info in paymentModes)
                {
                    string      xml      = HiCryptographer.Decrypt(info.Settings);
                    XmlDocument document = new XmlDocument();
                    document.LoadXml(xml);
                    if (document.GetElementsByTagName("Partner").Count != 0)
                    {
                        if ((!string.IsNullOrEmpty(document.GetElementsByTagName("Partner")[0].InnerText) && !string.IsNullOrEmpty(document.GetElementsByTagName("Key")[0].InnerText)) && !string.IsNullOrEmpty(document.GetElementsByTagName("Seller_account_name")[0].InnerText))
                        {
                            builder.AppendFormat("<li><a href=\"#\" name=\"{0}\">{1}</a></li>", info.ModeId, info.Name).AppendLine();
                        }
                    }
                    else if (!string.IsNullOrEmpty(document.GetElementsByTagName("SenderId")[0].InnerText) && !string.IsNullOrEmpty(document.GetElementsByTagName("SellerKey")[0].InnerText))
                    {
                        builder.AppendFormat("<li><a href=\"#\" name=\"{0}\">{1}</a></li>", info.ModeId, info.Name).AppendLine();
                    }
                }
            }
            builder.AppendLine("</ul>");
            writer.Write(builder.ToString());
        }
Exemple #10
0
 public string CreatePhoneCode(int length, string phone, VerifyCodeType CodeType = VerifyCodeType.Digital)
 {
     try
     {
         string text = this.GeneralCode(length, CodeType);
         HiCache.Insert($"DataCache-PhoneCode-{phone}", HiCryptographer.Encrypt(text), 1200);
         HttpCookie httpCookie = new HttpCookie(phone + "_PhoneVerifyCookie");
         httpCookie.HttpOnly = true;
         httpCookie.Value    = HiCryptographer.Encrypt(text);
         httpCookie.Expires  = DateTime.Now.AddMinutes(20.0);
         HttpContext.Current.Response.Cookies.Add(httpCookie);
         HiCache.Remove("smsnum" + phone);
         return(text);
     }
     catch (Exception ex)
     {
         Globals.WriteExceptionLog(ex, null, "CreateVerifyCode");
         return(string.Empty);
     }
 }
Exemple #11
0
 private void OpenIdEntryInit()
 {
     this.settings = MemberProcessor.GetOpenIdSettings(this.openIdType);
     if (this.settings == null)
     {
         this.ShowMessage("登录失败,没有找到对应的插件配置信息。", false, "/User/Login", 2);
     }
     else
     {
         this.Parameters = new NameValueCollection
         {
             this.Page.Request.Form,
             this.Page.Request.QueryString
         };
         this.notify = OpenIdNotify.CreateInstance(this.openIdType, this.Parameters);
         this.notify.Authenticated += this.Notify_Authenticated;
         this.notify.Failed        += this.Notify_Failed;
         this.notify.Verify(30000, HiCryptographer.Decrypt(this.settings.Settings));
     }
 }
Exemple #12
0
        protected int GetAmount(SiteSettings settings)
        {
            int result = 0;

            if (!string.IsNullOrEmpty(settings.SMSSettings))
            {
                string xml = HiCryptographer.Decrypt(settings.SMSSettings);
                System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
                xmlDocument.LoadXml(xml);
                string innerText = xmlDocument.SelectSingleNode("xml/Appkey").InnerText;
                string postData  = "method=getAmount&Appkey=" + innerText;
                string text      = this.PostData("http://sms.ecdev.cn/getAmount.aspx", postData);
                int    num;
                if (int.TryParse(text, out num))
                {
                    result = System.Convert.ToInt32(text);
                }
            }
            return(result);
        }
Exemple #13
0
        protected int GetAmount(SiteSettings settings)
        {
            int num = 0;

            if (!string.IsNullOrEmpty(settings.SMSSettings))
            {
                int         num2;
                string      xml      = HiCryptographer.Decrypt(settings.SMSSettings);
                XmlDocument document = new XmlDocument();
                document.LoadXml(xml);
                string innerText = document.SelectSingleNode("xml/Appkey").InnerText;
                string postData  = "method=getAmount&Appkey=" + innerText;
                string s         = this.PostData("http://sms.kuaidiantong.cn/getAmount.aspx", postData);
                if (int.TryParse(s, out num2))
                {
                    num = Convert.ToInt32(s);
                }
            }
            return(num);
        }
        protected void BindCheck_Click(object sender, EventArgs e)
        {
            int result = 0;

            if (int.TryParse(this.BindCheck.CommandName, out result))
            {
                string     text               = this.txtBindName.Text;
                string     sourceData         = this.txtUserPassword.Text;
                MemberInfo bindusernameMember = MemberProcessor.GetBindusernameMember(text);
                if ((bindusernameMember != null) && (bindusernameMember.UserId != result))
                {
                    this.ShowMsg("该用户名已经被绑定", false);
                }
                else if (bindusernameMember != null)
                {
                    this.ShowMsg("该用户已经绑定系统帐号", false);
                    this.LoadMemberInfo();
                }
                else if (MemberProcessor.BindUserName(result, text, HiCryptographer.Md5Encrypt(sourceData)))
                {
                    this.ShowMsg("用户绑定成功!", true);
                    MemberInfo member = MemberProcessor.GetMember(result, false);
                    try
                    {
                        Messenger.SendWeiXinMsg_SysBindUserName(member, sourceData);
                    }
                    catch
                    {
                    }
                    this.LoadMemberInfo();
                }
                else
                {
                    this.ShowMsg("用户绑定失败!", false);
                }
            }
            else
            {
                this.ShowMsg("用户不存在!", false);
            }
        }
        private bool DoAdd()
        {
            ManagerInfo model = new ManagerInfo();

            //SF.Model.manager model = new SF.Model.manager();
            SF.BLL.manager bll = new SF.BLL.manager();
            model.RoleId = int.Parse(ddlRoleId.SelectedValue);
            //model.role_type = new SF.BLL.manager_role().GetModel(model.role_id).role_type;
            //model.busnieseNum = "B" + DateTime.Now.ToString("yyyyMMddHHmmss");

            //model.type = 1;
            if (cbIsLock.Checked == true)
            {
                model.islock = "0";
            }
            else
            {
                model.islock = "1";
            }
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return(false);
            }
            model.UserName = txtUserName.Text.Trim();
            //获得6位的salt加密字符串
            //model.salt = SFUtils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.Password   = HiCryptographer.Md5Encrypt(txtPassword.Text.Trim());//DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.realname   = txtRealName.Text.Trim();
            model.telephone  = txtTelephone.Text.Trim();
            model.Email      = txtEmail.Text.Trim();
            model.CreateDate = DateTime.Now;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加商户:" + model.UserName); //记录日志
                return(true);
            }
            return(false);
        }
Exemple #16
0
        protected override void AttachChildControls()
        {
            this.orderId = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);

            if (orderInfo == null)
            {
                base.GotoResourceNotFound("");
            }
            if (!string.IsNullOrEmpty(orderInfo.Gateway) && (orderInfo.Gateway == "hishop.plugins.payment.offlinerequest"))
            {
                this.litMessage = (Literal)this.FindControl("litMessage");
                this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false).OffLinePayContent);
            }
            this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay");
            if (!string.IsNullOrEmpty(orderInfo.Gateway) && (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest"))
            {
                this.btnToPay.Visible = true;
                this.btnToPay.HRef    = "~/pay/wx_Submit.aspx?orderId=" + orderInfo.OrderId;
            }
            if ((!string.IsNullOrEmpty(orderInfo.Gateway) && (orderInfo.Gateway != "hishop.plugins.payment.podrequest")) && ((orderInfo.Gateway != "hishop.plugins.payment.offlinerequest") && (orderInfo.Gateway != "hishop.plugins.payment.weixinrequest")))
            {
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.PaymentTypeId);
                string          attach      = "";
                string          showUrl     = string.Format("http://{0}/vshop/", HttpContext.Current.Request.Url.Host);
                PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach).SendRequest();
            }
            else
            {
                this.litOrderId     = (Literal)this.FindControl("litOrderId");
                this.litOrderTotal  = (Literal)this.FindControl("litOrderTotal");
                this.litPaymentType = (HtmlInputHidden)this.FindControl("litPaymentType");
                this.litPaymentType.SetWhenIsNotNull(orderInfo.PaymentTypeId.ToString());
                this.litOrderId.SetWhenIsNotNull(this.orderId);
                this.litOrderTotal.SetWhenIsNotNull(orderInfo.GetTotal().ToString("F2"));
                this.litHelperText = (Literal)this.FindControl("litHelperText");
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent);
                PageTitle.AddSiteNameTitle("下单成功");
            }
        }
Exemple #17
0
        public static bool IsHavePermission(RolePermissionInfo model)
        {
            string str = HiCache.Get(string.Format("DataCache-RolePermissions-{0}", model.RoleId)) as string;
            List <RolePermissionInfo> permissionsByRoleId = new List <RolePermissionInfo>();

            if (!string.IsNullOrEmpty(str))
            {
                permissionsByRoleId = JsonConvert.DeserializeObject <List <RolePermissionInfo> >(HiCryptographer.Decrypt(str));
            }
            if ((permissionsByRoleId == null) || (permissionsByRoleId.Count == 0))
            {
                permissionsByRoleId = new RolePermissionDao().GetPermissionsByRoleId(model.RoleId);
                string str3 = HiCryptographer.Encrypt(JsonConvert.SerializeObject(permissionsByRoleId));
                HiCache.Insert(string.Format("DataCache-RolePermissions-{0}", model.RoleId), str3, 360, CacheItemPriority.Normal);
            }
            if ((permissionsByRoleId == null) || (permissionsByRoleId.Count == 0))
            {
                return(false);
            }
            return(permissionsByRoleId.FirstOrDefault <RolePermissionInfo>(p => (p.PermissionId == model.PermissionId)) != null);
        }
Exemple #18
0
        private string CreateAdministrator(string connectionstr)
        {
            DbConnection connection = new SqlConnection(connectionstr);

            connection.Open();
            DbCommand command = connection.CreateCommand();

            command.Connection  = connection;
            command.CommandType = CommandType.Text;
            command.CommandText = "INSERT INTO aspnet_Roles(RoleName,IsDefault) VALUES('超级管理员',1); SELECT @@IDENTITY";
            int num = Convert.ToInt32(command.ExecuteScalar());

            command.CommandText = "INSERT INTO aspnet_Managers(RoleId, UserName, Password, Email, CreateDate) VALUES (@RoleId, @UserName, @Password, @Email, getdate())";
            command.Parameters.Add(new SqlParameter("@RoleId", num));
            command.Parameters.Add(new SqlParameter("@Username", "admin"));
            command.Parameters.Add(new SqlParameter("@Password", HiCryptographer.Md5Encrypt("123456")));
            command.Parameters.Add(new SqlParameter("@Email", "*****@*****.**"));
            command.ExecuteNonQuery();
            connection.Close();
            return("");
        }
        private int GetAmount(SiteSettings settings)
        {
            int result = 0;

            if (!string.IsNullOrEmpty(settings.SMSSettings))
            {
                string      xml         = HiCryptographer.TryDecypt(settings.SMSSettings);
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.XmlResolver = null;
                xmlDocument.LoadXml(xml);
                string innerText  = xmlDocument.SelectSingleNode("xml/Appkey").InnerText;
                string postData   = "method=getAmount&Appkey=" + innerText;
                string postResult = Globals.GetPostResult("http://sms.huz.cn/getAmount.aspx", postData);
                int    num        = default(int);
                if (int.TryParse(postResult, out num))
                {
                    result = Convert.ToInt32(postResult);
                }
            }
            return(result);
        }
Exemple #20
0
        private static int GetLoggedOnUserId()
        {
            HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["PC-Member"];

            if (httpCookie == null)
            {
                httpCookie = HiContext.Current.Context.Request.Cookies["Shop-Member"];
            }
            if (httpCookie != null)
            {
                try
                {
                    return(int.Parse(HiCryptographer.Decrypt(httpCookie.Value)));
                }
                catch (Exception)
                {
                    return(0);
                }
            }
            return(0);
        }
Exemple #21
0
        protected string GetAmount(SiteSettings settings)
        {
            if (string.IsNullOrEmpty(settings.SMSSettings))
            {
                return("");
            }
            string      xml         = HiCryptographer.Decrypt(settings.SMSSettings);
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xml);
            string innerText = xmlDocument.SelectSingleNode("xml/Appkey").InnerText;
            string postData  = "method=getAmount&Appkey=" + innerText;
            string text      = this.PostData("http://sms.kuaidiantong.cn/getAmount.aspx", postData);
            int    num;

            if (int.TryParse(text, out num))
            {
                return("您的短信剩余条数为:" + text.ToString());
            }
            return("获取短信条数发生错误,请检查Appkey是否输入正确!");
        }
Exemple #22
0
        protected void BindCheck_Click(object sender, System.EventArgs e)
        {
            int num = 0;

            if (!int.TryParse(this.BindCheck.CommandName, out num))
            {
                this.ShowMsg("用户不存在!", false);
                return;
            }
            string     text  = this.txtBindName.Text;
            string     text2 = this.txtUserPassword.Text;
            MemberInfo bindusernameMember = MemberProcessor.GetBindusernameMember(text);

            if (bindusernameMember != null && bindusernameMember.UserId != num)
            {
                this.ShowMsg("该用户名已经被绑定", false);
                return;
            }
            if (bindusernameMember != null)
            {
                this.ShowMsg("该用户已经绑定系统帐号", false);
                this.LoadMemberInfo();
                return;
            }
            if (MemberProcessor.BindUserName(num, text, HiCryptographer.Md5Encrypt(text2)))
            {
                this.ShowMsg("用户绑定成功!", true);
                MemberInfo member = MemberProcessor.GetMember(num, false);
                try
                {
                    Messenger.SendWeiXinMsg_SysBindUserName(member, text2);
                }
                catch
                {
                }
                this.LoadMemberInfo();
                return;
            }
            this.ShowMsg("用户绑定失败!", false);
        }
Exemple #23
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            System.Collections.Specialized.NameValueCollection parameters = new System.Collections.Specialized.NameValueCollection
            {
                this.Page.Request.Form,
                this.Page.Request.QueryString
            };
            this.Gateway = this.Page.Request.QueryString["HIGW"];
            this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
            if (this.isBackRequest)
            {
                this.Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorPaymentReturn_url", new object[]
                {
                    this.Gateway
                })) + "?" + this.Page.Request.Url.Query;
            }
            this.PurchaseOrderId = this.Notify.GetOrderId();
            this.PurchaseOrder   = SubsiteSalesHelper.GetPurchaseOrder(this.PurchaseOrderId);
            if (this.PurchaseOrder == null)
            {
                this.ResponseStatus(true, "purchaseordernotfound");
                return;
            }
            this.Amount = this.Notify.GetOrderAmount();
            if (this.Amount <= 0m)
            {
                this.Amount = this.PurchaseOrder.GetPurchaseTotal();
            }
            PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(this.PurchaseOrder.PaymentTypeId);

            if (paymentMode == null)
            {
                this.ResponseStatus(true, "gatewaynotfound");
                return;
            }
            this.Notify.Finished          += new System.EventHandler <FinishedEventArgs>(this.Notify_Finished);
            this.Notify.NotifyVerifyFaild += new System.EventHandler(this.Notify_NotifyVerifyFaild);
            this.Notify.Payment           += new System.EventHandler(this.Notify_Payment);
            this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(paymentMode.Settings));
        }
Exemple #24
0
        private void saveData()
        {
            if (string.IsNullOrEmpty(this.txt_mid.Text))
            {
                this.ShowMsg("请输入商户号!", false);
            }
            this.siteSettings.ShenPay_mid = this.txt_mid.Text;
            if (string.IsNullOrEmpty(this.txt_key.Text))
            {
                this.ShowMsg("请输入商家密钥(Key)!", false);
            }
            this.siteSettings.ShenPay_key = this.txt_key.Text;
            SettingsManager.Save(this.siteSettings);
            string          text        = string.Format("<xml><SenderId>{0}</SenderId><SellerKey>{1}</SellerKey><Seller_account_name></Seller_account_name></xml>", this.txt_mid.Text, this.txt_key.Text);
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest");

            if (paymentMode == null)
            {
                PaymentModeInfo paymentMode2 = new PaymentModeInfo
                {
                    Name            = "盛付通手机网页支付",
                    Gateway         = "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest",
                    Description     = string.Empty,
                    IsUseInpour     = false,
                    Charge          = 0m,
                    IsPercent       = false,
                    ApplicationType = PayApplicationType.payOnWAP,
                    Settings        = HiCryptographer.Encrypt(text)
                };
                SalesHelper.CreatePaymentMode(paymentMode2);
            }
            else
            {
                PaymentModeInfo paymentModeInfo = paymentMode;
                paymentModeInfo.Settings        = HiCryptographer.Encrypt(text);
                paymentModeInfo.ApplicationType = PayApplicationType.payOnWAP;
                SalesHelper.UpdatePaymentMode(paymentModeInfo);
            }
            this.ShowMsg("保存成功!", true);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.radEnableAppAliPay.Parameter.Add("onSwitchChange", "fuCheckEnableZFBPay");
     this.radEnableWapAliPay.Parameter.Add("onSwitchChange", "fuCheckEnableZFBPage");
     if (!this.Page.IsPostBack)
     {
         SiteSettings masterSettings = SettingsManager.GetMasterSettings();
         this.radEnableAppAliPay.SelectedValue = masterSettings.EnableAppAliPay;
         this.radEnableWapAliPay.SelectedValue = masterSettings.EnableAppWapAliPay;
         PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest");
         if (paymentMode != null)
         {
             string      xml         = HiCryptographer.Decrypt(paymentMode.Settings);
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.XmlResolver = null;
             xmlDocument.LoadXml(xml);
             this.txtPartner.Text = xmlDocument.FirstChild.SelectSingleNode("Partner").InnerText;
             if (xmlDocument.FirstChild.SelectSingleNode("Key") != null)
             {
                 this.txtKey.Text = xmlDocument.FirstChild.SelectSingleNode("Key").InnerText;
             }
             if (xmlDocument.FirstChild.SelectSingleNode("PublicKey") != null)
             {
                 this.txtPublicKey.Text = xmlDocument.FirstChild.SelectSingleNode("PublicKey").InnerText;
             }
         }
         PaymentModeInfo paymentMode2 = SalesHelper.GetPaymentMode("hishop.plugins.payment.ws_apppay.wswappayrequest");
         if (paymentMode2 != null)
         {
             string      xml2         = HiCryptographer.Decrypt(paymentMode2.Settings);
             XmlDocument xmlDocument2 = new XmlDocument();
             xmlDocument2.XmlResolver = null;
             xmlDocument2.LoadXml(xml2);
             this.txtAppPartner.Text = xmlDocument2.GetElementsByTagName("Partner")[0].InnerText;
             this.txtAppKey.Text     = xmlDocument2.GetElementsByTagName("Key")[0].InnerText;
             this.txtAppAccount.Text = xmlDocument2.GetElementsByTagName("Seller_account_name")[0].InnerText;
         }
     }
 }
Exemple #26
0
        private void BindErpLink()
        {
            string text      = DateTime.Now.ToString("yyy-MM-dd HH:mm:ss");
            string checkCode = HiContext.Current.SiteSettings.CheckCode;
            string text2     = HiContext.Current.SiteSettings.AppKey;

            if (string.IsNullOrEmpty(text2))
            {
                text2 = this.CreateAppKey();
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                masterSettings.AppKey = text2;
                SettingsManager.Save(masterSettings);
                this.RegisterERP(text2, checkCode);
            }
            SortedDictionary <string, string> sortedDictionary = new SortedDictionary <string, string>();

            sortedDictionary.Add("app_key", text2);
            sortedDictionary.Add("timestamp", text);
            string text3 = HiCryptographer.SignTopRequest(sortedDictionary, checkCode);

            this.hplinkprint.NavigateUrl = "http://hierp.huz.cn/ExpressBill/Allot?app_key=" + text2 + "&timestamp=" + text + "&sign=" + text3;
        }
Exemple #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Context.Request.IsAuthenticated)
            {
                FormsAuthentication.SignOut();
                HttpCookie  authCookie = FormsAuthentication.GetAuthCookie(HiContext.Current.User.Username, true);
                IUserCookie userCookie = HiContext.Current.User.GetUserCookie();
                if (userCookie != null)
                {
                    userCookie.DeleteCookie(authCookie);
                }
                RoleHelper.SignOut(HiContext.Current.User.Username);
            }
            this.openIdType = this.Page.Request.QueryString["HIGW"];
            OpenIdSettingsInfo openIdSettings = MemberProcessor.GetOpenIdSettings(this.openIdType);

            if (openIdSettings == null)
            {
                base.Response.Write("登录失败,没有找到对应的插件配置信息。");
            }
            else
            {
                NameValueCollection values = new NameValueCollection();
                values.Add(this.Page.Request.Form);
                values.Add(this.Page.Request.QueryString);
                this.parameters = values;
                OpenIdNotify notify = OpenIdNotify.CreateInstance(this.openIdType, this.parameters);
                notify.Authenticated += new EventHandler <AuthenticatedEventArgs>(this.Notify_Authenticated);
                notify.Failed        += new EventHandler <FailedEventArgs>(this.Notify_Failed);
                try
                {
                    notify.Verify(0x7530, HiCryptographer.Decrypt(openIdSettings.Settings));
                }
                catch
                {
                    this.Page.Response.Redirect(Globals.GetSiteUrls().Home);
                }
            }
        }
Exemple #28
0
 public string CreateVerifyCode(int length, VerifyCodeType CodeType = VerifyCodeType.Digital, string openId = "")
 {
     try
     {
         string text = this.GeneralCode(length, CodeType).Trim();
         if (!string.IsNullOrEmpty(openId))
         {
             HiCache.Insert(openId, HiCryptographer.Encrypt(text), 1200);
         }
         HttpCookie httpCookie = new HttpCookie("VerifyCookie");
         httpCookie.HttpOnly = true;
         httpCookie.Value    = HiCryptographer.Encrypt(text);
         httpCookie.Expires  = DateTime.Now.AddMinutes(20.0);
         HttpContext.Current.Response.Cookies.Add(httpCookie);
         return(text);
     }
     catch (Exception ex)
     {
         Globals.WriteExceptionLog(ex, null, "CreateVerifyCode");
         return(string.Empty);
     }
 }
Exemple #29
0
        public bool CheckVerifyCode(string verifyCode, string openId = "")
        {
            if (!string.IsNullOrEmpty(openId))
            {
                string text = HiCache.Get(openId).ToNullString();
                if (string.IsNullOrEmpty(text) && DataHelper.IsMobile(openId))
                {
                    text = HiCache.Get($"DataCache-PhoneCode-{openId}").ToNullString();
                }
                if (string.IsNullOrEmpty(text) && DataHelper.IsEmail(openId))
                {
                    text = HiCache.Get($"DataCache-EmailCode-{openId}").ToNullString();
                }
                if (!string.IsNullOrEmpty(text))
                {
                    bool flag = string.Compare(HiCryptographer.Decrypt(text), verifyCode, true, CultureInfo.InvariantCulture) == 0;
                    if (flag)
                    {
                        HiCache.Remove($"DataCache-PhoneCode-{openId}");
                        HiCache.Remove($"DataCache-EmailCode-{openId}");
                        HiCache.Remove(openId);
                    }
                    return(flag);
                }
            }
            HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["VerifyCookie"];
            string     text2      = string.Empty;

            if (httpCookie != null)
            {
                text2 = httpCookie.Value;
            }
            if (!string.IsNullOrEmpty(text2))
            {
                text2 = HiCryptographer.Decrypt(text2);
                return(string.Compare(text2, verifyCode, true, CultureInfo.InvariantCulture) == 0);
            }
            return(false);
        }
Exemple #30
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string     str;
            ConfigData data;
            decimal    num;

            if (this.ValidateValues(out str, out data, out num))
            {
                PaymentModeInfo info2 = new PaymentModeInfo();
                info2.ModeId             = this.modeId;
                info2.Name               = this.txtName.Text.Trim();
                info2.Description        = this.fcContent.Text.Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
                info2.Gateway            = str;
                info2.IsUseInpour        = this.radiIsUseInpour.SelectedValue;
                info2.IsUseInDistributor = this.radiIsUseInDistributor.SelectedValue;
                info2.Charge             = num;
                info2.IsPercent          = this.chkIsPercent.Checked;
                info2.Settings           = HiCryptographer.Encrypt(data.SettingsXml);
                PaymentModeInfo paymentMode = info2;
                switch (SalesHelper.UpdatePaymentMode(paymentMode))
                {
                case PaymentModeActionStatus.Success:
                    base.Response.Redirect(Globals.GetAdminAbsolutePath("sales/PaymentTypes.aspx"));
                    return;

                case PaymentModeActionStatus.DuplicateName:
                    this.ShowMsg("已经存在一个相同的支付方式名称", false);
                    return;

                case PaymentModeActionStatus.OutofNumber:
                    this.ShowMsg("支付方式的数目已经超出系统设置的数目", false);
                    return;

                case PaymentModeActionStatus.UnknowError:
                    this.ShowMsg("未知错误", false);
                    break;
                }
            }
        }