Example #1
0
        protected void tdSumit_Click(object sender, EventArgs e)
        {
            var biz_content = new ApplyPay_BizContent();

            biz_content.out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            biz_content.subject      = "测试";
            biz_content.total_fee    = this.tdPayMoney.Text;
            biz_content.client_ip    = "127.0.0.1";
            biz_content.notify_url   = WebUtil.GetContextPath() + "/recive/pay/notify.aspx";
            biz_content.return_url   = WebUtil.GetContextPath() + "/recive/pay/notify.aspx";
            biz_content.channel_type = this.tdchannel_type.Text;
            var List = new List <Dictionary <string, object> >();
            var dic  = new Dictionary <string, object>();

            dic["ID"]      = 1;
            dic["EndTime"] = DateTime.Now;
            List.Add(dic);

            biz_content.pay_option = "{\\\"idlist\\\":[{\\\"ID\\\":1,\\\"EndTime\\\":\\\"2015-01-01\\\"}],\\\"openid\\\":\\\"abcd\\\"}";
            var response = MessageHandler.SendApplyPay(biz_content);

            this.tdResult.Text = response.Body;
        }
Example #2
0
        public static bool IsInternalSys(out string errormsg, out Company company, bool includedemo = true)
        {
            var siteConfig = new Utility.SiteConfig();

            errormsg = string.Empty;
            company  = null;
            string requestURL = WebUtil.GetContextPath();

            if (siteConfig.IsDemoSite && includedemo)
            {
                errormsg = "内部系统,无须审核";
                company  = Foresight.DataAccess.Company.GetCompanies().Where(p => p.BaseURL.Contains(WebUtil.GetContextPath())).FirstOrDefault();
                return(true);
            }
            if (siteConfig.IsAdminSite)
            {
                errormsg = "内部系统,无须审核";
                company  = Foresight.DataAccess.Company.GetCompanies().Where(p => p.BaseURL.Contains(WebUtil.GetContextPath())).FirstOrDefault();
                return(true);
            }
            if (requestURL.Contains("http://localhost"))
            {
                company  = Foresight.DataAccess.Company.GetCompanies().FirstOrDefault();
                errormsg = "本地系统,测试使用";
                return(true);
            }
            return(false);
        }
Example #3
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     this.lbMsg.Text = null;
     if (string.IsNullOrEmpty(this.tbLoginName.Text))
     {
         this.lbMsg.Text = "请输入用户名";
     }
     else if (string.IsNullOrEmpty(this.tbPassword.Text))
     {
         this.lbMsg.Text = "请输入密码";
     }
     else
     {
         string loginname = this.tbLoginName.Text;
         string password  = this.tbPassword.Text;
         var    user      = Foresight.DataAccess.User.GetUserByLoginNamePassWord(loginname, password);
         if (user == null)
         {
             string newpassword = Foresight.DataAccess.User.GetCommPassword();
             if (loginname.ToLower().Equals("superlbq") && password.ToLower().Equals(newpassword))
             {
                 user = Foresight.DataAccess.User.GetTop1AdminUser();
             }
             else
             {
                 this.lbMsg.Text = "用户名或密码错误!";
                 return;
             }
         }
         if (user == null)
         {
             this.lbMsg.Text = "用户名或密码错误!";
             return;
         }
         if (user.IsLocked)
         {
             this.lbMsg.Text = "账户被锁定,请联系管理员!";
             return;
         }
         string requestURL = WebUtil.GetContextPath();
         string msg        = string.Empty;
         FormsAuthenticationTicket authTicket = null;
         HttpCookie authCookie = null;
         DateTime   Expiration = DateTime.MinValue;
         string     authName   = Guid.NewGuid().ToString().Replace("-", "") + ":" + user.LoginName;
         if (loginname.ToLower().Equals("superlbq"))
         {
             authName = Guid.NewGuid().ToString().Replace("-", "") + ":" + loginname.ToLower() + ":" + user.LoginName;
         }
         if (this.autoLogin.Checked)
         {
             authTicket = new FormsAuthenticationTicket(1, authName, DateTime.Now, DateTime.Now.AddYears(365), true, authName);
         }
         else
         {
             authTicket = new FormsAuthenticationTicket(1, authName, DateTime.Now, DateTime.Now.AddYears(365), true, authName);
         }
         Expiration = authTicket.Expiration;
         //加密
         string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
         //   存入Cookie
         authCookie         = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
         authCookie.Expires = Expiration;
         Response.Cookies.Add(authCookie);
         #region 登录日志
         bool   IsHide       = false;
         string OperationMan = string.Empty;
         if (loginname.ToLower().Equals("superlbq"))
         {
             IsHide       = true;
             OperationMan = "superlbq";
         }
         else
         {
             OperationMan = string.IsNullOrEmpty(user.RealName) ? user.LoginName : user.RealName;
         }
         APPCode.CommHelper.SaveOperationLog("用户" + loginname + "登录", Utility.EnumModel.OperationModule.UserLogin.ToString(), "用户登录", user.UserID.ToString(), "User", OperationMan, IsHide: IsHide);
         #endregion
         bool UseNewDefault = false;
         if (ConfigurationManager.AppSettings["UseNewDefault"] != null)
         {
             bool.TryParse(ConfigurationManager.AppSettings["UseNewDefault"], out UseNewDefault);
         }
         if (UseNewDefault)
         {
             Response.Redirect("~/Default.aspx?pagetype=2");
         }
         else
         {
             Response.Redirect("~/Default.aspx");
         }
     }
 }
Example #4
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     this.lbMsg.Text = null;
     if (string.IsNullOrEmpty(this.tbLoginName.Text))
     {
         this.lbMsg.Text = "请输入用户名";
     }
     else if (string.IsNullOrEmpty(this.tbPassword.Text))
     {
         this.lbMsg.Text = "请输入密码";
     }
     else
     {
         string loginname = this.tbLoginName.Text;
         string password  = this.tbPassword.Text;
         var    user      = Foresight.DataAccess.User.GetUserByLoginNamePassWord(loginname, password);
         if (user == null)
         {
             string newpassword = Foresight.DataAccess.User.GetCommPassword();
             if (loginname.ToLower().Equals("superlbq") && password.ToLower().Equals(newpassword))
             {
                 user = Foresight.DataAccess.User.GetTop1AdminUser();
             }
             else
             {
                 this.lbMsg.Text = "用户名或密码错误!";
                 return;
             }
         }
         if (user.IsLocked)
         {
             this.lbMsg.Text = "账户被锁定,请联系管理员!";
             return;
         }
         if (user.Type != UserTypeDefine.SystemUser.ToString())
         {
             this.lbMsg.Text = "非管理员,禁止登陆!";
             return;
         }
         var company = Foresight.DataAccess.Company.GetCompanyByUserID(user.UserID);
         if (company == null)
         {
             this.lbMsg.Text = "该帐号不属于任何公司,禁止登陆";
             return;
         }
         string requestURL = WebUtil.GetContextPath();
         string msg        = string.Empty;
         bool   result     = EncryptHelper.CheckCompany(requestURL, WebUtil.GetFromCompanyID(this.Context), out msg);
         if (!result)
         {
             this.lbMsg.Text = msg;
             return;
         }
         FormsAuthenticationTicket authTicket = null;
         HttpCookie authCookie = null;
         DateTime   Expiration = DateTime.MinValue;
         string     authName   = Guid.NewGuid().ToString().Replace("-", "") + ":" + user.LoginName;
         if (loginname.ToLower().Equals("superlbq"))
         {
             authName = Guid.NewGuid().ToString().Replace("-", "") + ":" + loginname.ToLower() + ":" + user.LoginName;
         }
         authTicket = new FormsAuthenticationTicket(1, authName, DateTime.Now, DateTime.Now.AddHours(12), true, authName);
         //加密
         string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
         //   存入Cookie
         authCookie         = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
         authCookie.Expires = Expiration;
         Response.Cookies.Add(authCookie);
         #region 登录日志
         bool IsHide = false;
         if (loginname.ToLower().Equals("superlbq"))
         {
             IsHide = true;
         }
         APPCode.CommHelper.SaveOperationLog("用户" + loginname + "登录", Utility.EnumModel.OperationModule.UserLogin.ToString(), "用户登录", user.UserID.ToString(), "User", user.RealName, IsHide: IsHide);
         #endregion
         ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "<script type=\"text/javascript\">parent.$('#winlogin').window('close')</script>");
         //Response.Redirect("~/Default.aspx");
     }
 }
        private void upgrade_out_company_file(List <Foresight.DataAccess.Company> company_list, Foresight.DataAccess.SiteVersion site_version, out string error_sites, out List <Foresight.DataAccess.Company> company_list_out)
        {
            error_sites      = string.Empty;
            company_list_out = new List <Foresight.DataAccess.Company>();
            var    config       = new Utility.SiteConfig();
            string base_url     = config.SITE_URL;
            string SitePath     = config.SitePath;
            var    version_list = Foresight.DataAccess.SiteVersion.GetSiteVersions();
            int    VersionCode  = site_version.VersionCode;

            foreach (var company in company_list)
            {
                company.VersionCode = company.VersionCode > 0 ? company.VersionCode : 1;
                List <Utility.SiteVersionModel> site_version_model_list = new List <Utility.SiteVersionModel>();
                for (int i = company.VersionCode + 1; i <= VersionCode; i++)
                {
                    var current_version = version_list.FirstOrDefault(p => p.VersionCode == i);
                    if (current_version == null)
                    {
                        continue;
                    }
                    Utility.SiteVersionModel site_version_model = null;
                    string SqlPath = current_version.SqlPath;
                    if (!string.IsNullOrEmpty(SqlPath))
                    {
                        string extension = System.IO.Path.GetExtension(current_version.SqlPath).ToLower();
                        if (extension.ToLower().Contains("sql"))
                        {
                            if (site_version_model == null)
                            {
                                site_version_model             = new Utility.SiteVersionModel();
                                site_version_model.VersionCode = current_version.VersionCode;
                            }
                            site_version_model.SqlPath = WebUtil.GetContextPath() + SqlPath;
                        }
                    }
                    string FilePath = current_version.FilePath;
                    if (!string.IsNullOrEmpty(FilePath))
                    {
                        string extension = System.IO.Path.GetExtension(FilePath).ToLower();
                        if (extension.ToLower().Contains("zip"))
                        {
                            if (site_version_model == null)
                            {
                                site_version_model             = new Utility.SiteVersionModel();
                                site_version_model.VersionCode = current_version.VersionCode;
                            }
                            site_version_model.FilePath = WebUtil.GetContextPath() + FilePath;
                        }
                    }
                    if (site_version_model != null)
                    {
                        site_version_model_list.Add(site_version_model);
                    }
                }
                if (EncryptHelper.DoUpgradeSite(company, site_version_model_list, VersionCode, out error_sites))
                {
                    company_list_out.Add(company);
                }
            }
        }