示例#1
0
 public override Map Execute(Map input, ServerFacade sf, ConfigHelper cfg, out bool hasMore, out bool cut)
 {
     hasMore = false;
     var text = this.GetString("content");
     var cached = this["cached"] as ScriptEngine;
     if (cached == null) {
         var script = new ScriptEngine();
         script.References("Solari.Core.dll");
         script.Using("Solari.Core");
         script.DeclareGlobal("sf", typeof(ServerFacade), sf);
         script.DeclareGlobal("cfg", typeof(Map), cfg.Data);
         script.DeclareGlobal("context", typeof(Map), this);
         try {
             script.SetCode("public bool Filter(Map input) { " + text + " ; return false; }");
             script.Compile();
             this["cached"] = script;
             cut = !(bool)script.Execute("Filter", input);
             return input;
         } catch (Exception ex) {
             throw new ScriptingException(ex);
         }
     } else {
         var script = cached;
         try {
             cut = !(bool)script.Execute("Filter", input);
             return input;
         } catch (Exception ex) {
             throw new ScriptingException(ex);
         }
     }
 }
示例#2
0
        public ActionResult Index()
        {
            Func<string, FileVersionInfo> getFileVersionInfo = dllFileName => 
                FileVersionInfo.GetVersionInfo(Server.MapPath("~/bin/" + dllFileName));

            Func<FileVersionInfo, string> getDisplayVersion = fileVersionInfo =>
                 Regex.Match(fileVersionInfo.FileVersion, @"\d+\.\d+\.\d+").Value;

            TempData["WeixinVersion"] = getDisplayVersion(getFileVersionInfo("Senparc.Weixin.dll"));
            TempData["MpVersion"] = getDisplayVersion(getFileVersionInfo("Senparc.Weixin.MP.dll"));
            TempData["ExtensionVersion"] = getDisplayVersion(getFileVersionInfo("Senparc.Weixin.MP.MvcExtension.dll"));
            TempData["OpenVersion"] = getDisplayVersion(getFileVersionInfo("Senparc.Weixin.Open.dll"));
            TempData["QYVersion"] = getDisplayVersion(getFileVersionInfo("Senparc.Weixin.QY.dll"));
            TempData["RedisCacheVersion"] = getDisplayVersion(getFileVersionInfo("Senparc.Weixin.Cache.Redis.dll"));
            TempData["MemcachedCacheVersion"] = getDisplayVersion(getFileVersionInfo("Senparc.Weixin.Cache.Memcached.dll"));
            TempData["WxOpenVersion"] = getDisplayVersion(getFileVersionInfo("Senparc.Weixin.WxOpen.dll"));

            //缓存
            //var containerCacheStrategy = CacheStrategyFactory.GetContainerCacheStrategyInstance();
            var containerCacheStrategy = CacheStrategyFactory.GetObjectCacheStrategyInstance().ContainerCacheStrategy;
            TempData["CacheStrategy"] = containerCacheStrategy.GetType().Name.Replace("ContainerCacheStrategy","");

            //文档下载版本
            var configHelper = new ConfigHelper(this.HttpContext);
            var config = configHelper.GetConfig();
            TempData["NewestDocumentVersion"] = config.Versions.First();

            return View();
        }
        public ActionResult Index()
        {
            var guid = Guid.NewGuid().ToString("n");
            ViewData["Guid"] = guid;

            var configHelper = new ConfigHelper(this.HttpContext);

            //chm二维码
            var qrCodeId = configHelper.GetQrCodeId();
            var qrResult = AdvancedAPIs.QrCodeApi.Create(appId,10000, qrCodeId, QrCode_ActionName.QR_SCENE);

            var qrCodeUrl = AdvancedAPIs.QrCodeApi.GetShowQrCodeUrl(qrResult.ticket);
            ViewData["QrCodeUrl"] = qrCodeUrl;

            ConfigHelper.CodeCollection[guid] = new CodeRecord()
            {
                Key = guid,
                QrCodeId = qrCodeId,
                QrCodeTicket = qrResult
            };//添加对应关系

            //下载版本
            var config = configHelper.GetConfig();
            ViewData["Versions"] = config.Versions;
            ViewData["WebVersions"] = config.WebVersions;
            ViewData["DownloadCount"] = config.DownloadCount.ToString("##,###");

            return View();
        }
示例#4
0
文件: Http.cs 项目: mariocosmi/Worker
 public override Map Execute(Map input, ServerFacade sf, ConfigHelper cfg, out bool hasMore, out bool cut)
 {
     var mc = new MiniClient(Utils.EvalExpression(this.GetString("content"), input).Trim(), 60000);
     var data = mc.Get("");
     hasMore = cut = false;
     return Map.FromJsonObject(data);
 }
示例#5
0
 protected ReadWorkspace(DocumentConfig path)
 {
     if (path == null)
     {
         throw new ArgumentNullException(nameof(path));
     }
     _path = new ConfigHelper<string>(path);
 }
示例#6
0
文件: Meta.cs 项目: martinvobr/Wyam
 /// <summary>
 /// Uses a function to determine an object to be added as metadata for each document. 
 /// This allows you to specify different metadata for each document depending on the input.
 /// </summary>
 /// <param name="key">The metadata key to set.</param>
 /// <param name="metadata">A delegate that returns the object to add as metadata.</param>
 public Meta(string key, DocumentConfig metadata)
 {
     if (key == null)
     {
         throw new ArgumentNullException(nameof(key));
     }
     _key = key;
     _metadata = new ConfigHelper<object>(metadata);
 }
示例#7
0
文件: Mail.cs 项目: mariocosmi/Worker
        public override Map Execute(Map input, ServerFacade sf, ConfigHelper cfg, out bool hasMore, out bool cut)
        {
            hasMore = false;
            cut = false;
            string testo;
            if (VelocityHelper.RenderStringTemplateToString(this.GetString("content"), input, out testo) && testo.Length > 0)
                SendMail(input, cfg.Data);

            return input;
        }
示例#8
0
 public static ConfigHelper Instance()
 {
     lock (obj)
     {
         if (configHelper == null)
         {
             configHelper = new ConfigHelper();
         }
     }
     return configHelper;
 }
示例#9
0
 protected ReadWorkspace(string path)
 {
     if (path == null)
     {
         throw new ArgumentNullException(nameof(path));
     }
     if (string.IsNullOrWhiteSpace(path))
     {
         throw new ArgumentException(nameof(path));
     }
     _path = new ConfigHelper<string>(path);
 }
示例#10
0
 public override Map Execute(Map input, ServerFacade sf, ConfigHelper cfg, out bool hasMore, out bool cut)
 {
     hasMore = cut = false;
     var fields = this.GetString("fields").Split(',');
     var data = Utils.SelectValues(input, this.GetString("path"));
     if (data != null)
         using (TextWriter tw = new StreamWriter(Utils.EvalExpression(this.GetString("outfile"), input))) {
             foreach (Map map in data)
                 WriteCsvMap(tw, map, fields);
         }
     return input;
 }
示例#11
0
 public EmailManager()
 {
     try
     {
         ConfigHelper config = new ConfigHelper();
         _repository = config.GetRepository("RestrictedSymbolList");
         string serverName = ConfigurationManager.AppSettings["SMTPServer"];
         _client = new SmtpClient(serverName);
     }
     catch (Exception ex)
     {
         throw new ApplicationException("SMTP Client Init Error: " + ex.Message);
     }
 }
示例#12
0
 public override Map Execute(Map input, ServerFacade sf, ConfigHelper cfg, out bool hasMore, out bool cut)
 {
     var vett = Utils.SelectValues(input, this.GetString("path"));
     var ret = new Map();
     var idx = -1;
     if (vett != null) {
         idx = this.GetInt("__IDX__", 0);
         this["__IDX__"] = idx + 1;
         if (idx < vett.Count)
             ret = vett[idx] as Map;
     }
     hasMore = vett != null && idx < vett.Count - 1;
     cut = false;
     return ret;
 }
示例#13
0
 public override Map Execute(Map input, ServerFacade sf, ConfigHelper cfg, out bool hasMore, out bool cut)
 {
     hasMore = false;
     if (!this.ContainsKey("__DATA__")) {
         var text = this.GetString("content");
         this["__DATA__"] = Utils.List(sf, text, input);
     }
     var vett = this.GetArray("__DATA__");
     var ret = new Map();
     var idx = -1;
     if (vett != null) {
         idx = this.GetInt("__IDX__", 0);
         this["__IDX__"] = idx + 1;
         if (idx < vett.Count)
             ret = vett[idx] as Map;
     }
     hasMore = vett != null && idx < vett.Count - 1;
     cut = false;
     return ret;
 }
    public WebMailService()
    {
        m_ConfigHelper = new ConfigHelper();
        m_SystemFactory = new SystemFactory();
        m_SystemService = m_SystemFactory.GetSystemService();

        m_MailVO = m_SystemService.GetSystemParamByRoot();

        bool enableSSL = m_MailVO.EnableSSL;
        int port = 25;

        if (m_MailVO.MailSmtp.IndexOf("gmail") != -1)
        {
            enableSSL = true;
            port = 587;
        }
        else if (!string.IsNullOrEmpty(m_MailVO.MailPort))
        {
            port = int.Parse(m_MailVO.MailPort);
        }

        m_MailService = new MailService(m_MailVO.MailSmtp, port, enableSSL, m_MailVO.Account, m_MailVO.Password);
    }
示例#15
0
 public override Map Execute(Map input, ServerFacade sf, ConfigHelper cfg, out bool hasMore, out bool cut)
 {
     hasMore = cut = false;
     var text = this.GetString("content");
     var cached = this["cached"] as ScriptEngine;
     if (cached == null) {
         System.Diagnostics.Debug.WriteLine("Compila script per " + this.Uid);
         var script = new ScriptEngine();
         script.References("Solari.Core.dll");
         script.Using("Solari.Core");
         script.DeclareGlobal("sf", typeof (ServerFacade), sf);
         script.DeclareGlobal("cfg", typeof (Map), cfg.Data);
         script.DeclareGlobal("context", typeof (Map), this);
         script.DeclareGlobal("hasMore", typeof (bool), false);
         try {
             script.SetCode("public Map DoExecute(Map input) { hasMore = false; " + text + " ; return input; }");
             script.Compile();
             this["cached"] = script;
             var ret = script.Execute("DoExecute", input) as Map;
             hasMore = (bool) script.GlobalGet("hasMore");
             return ret;
         }
         catch (Exception ex) {
             throw new ScriptingException(ex);
         }
     } else {
         System.Diagnostics.Debug.WriteLine("Trova in cache script per " + this.Uid);
         var script = cached;
         try {
             var ret = script.Execute("DoExecute", input) as Map;
             hasMore = (bool)script.GlobalGet("hasMore");
             return ret;
         } catch (Exception ex) {
             throw new ScriptingException(ex);
         }
     }
 }
示例#16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ConfigHelper = new ConfigHelper();
        m_WebLogService = new WebLogService();
        m_PostFactory = new PostFactory();
        m_MemberFactory = new MemberFactory();
        m_AuthFactory = new AuthFactory();
        m_HttpHelper = new HttpHelper();
        m_SessionHelper = new SessionHelper();
        m_AuthService = m_AuthFactory.GetAuthService();
        m_MemberService = m_MemberFactory.GetMemberService();
        m_PostService = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            pnlContent.Visible = false;
            fillGridView();
            ShowMode();
            InitDDL();
        }
    }
示例#17
0
 public RepoConnection(ConfigHelper configHelper, Logger logger)
 {
     ConfigHelper = configHelper;
     Logger       = logger;
     dbService    = new DbService(ConfigHelper, Logger);
 }
示例#18
0
        public static ConfigHelper GetInstance()
        {
            _mu.WaitOne();
            try
            {
                if (_config == null)
                    _config = new ConfigHelper();
            }
            finally
            {
                _mu.ReleaseMutex();
            }

            return (_config);
        }
示例#19
0
        private static Collection <PageSettings> LoadMenuPages()
        {
            Collection <PageSettings> menuPages = new Collection <PageSettings>();

            SiteSettings siteSettings = GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                return(menuPages);
            }

            bool useFolderForSiteDetection
                = ConfigHelper.GetBoolProperty("UseFoldersInsteadOfHostnamesForMultipleSites", false);
            string virtualFolder;

            if (useFolderForSiteDetection)
            {
                virtualFolder = VirtualFolderEvaluator.VirtualFolderName();
            }
            else
            {
                virtualFolder = string.Empty;
            }


            using (IDataReader reader = PageSettings.GetPageList(siteSettings.SiteId))
            {
                int i = 0;
                while (reader.Read())
                {
                    PageSettings pageDetails = new PageSettings();
                    pageDetails.SiteId               = siteSettings.SiteId;
                    pageDetails.PageId               = Convert.ToInt32(reader["PageID"]);
                    pageDetails.ParentId             = Convert.ToInt32(reader["ParentID"]);
                    pageDetails.PageName             = reader["PageName"].ToString();
                    pageDetails.PageMetaDescription  = reader["PageDescription"].ToString();
                    pageDetails.MenuDescription      = reader["MenuDesc"].ToString();
                    pageDetails.MenuImage            = reader["MenuImage"].ToString();
                    pageDetails.PageOrder            = Convert.ToInt32(reader["PageOrder"]);
                    pageDetails.AuthorizedRoles      = reader["AuthorizedRoles"].ToString();
                    pageDetails.EditRoles            = reader["EditRoles"].ToString();
                    pageDetails.DraftEditOnlyRoles   = reader["DraftEditRoles"].ToString();
                    pageDetails.CreateChildPageRoles = reader["CreateChildPageRoles"].ToString();


                    pageDetails.UseUrl             = Convert.ToBoolean(reader["UseUrl"]);
                    pageDetails.Url                = reader["Url"].ToString();
                    pageDetails.UnmodifiedUrl      = reader["Url"].ToString();
                    pageDetails.LinkRel            = reader["LinkRel"].ToString();
                    pageDetails.IncludeInMenu      = Convert.ToBoolean(reader["IncludeInMenu"]);
                    pageDetails.IncludeInSiteMap   = Convert.ToBoolean(reader["IncludeInSiteMap"]);
                    pageDetails.ExpandOnSiteMap    = Convert.ToBoolean(reader["ExpandOnSiteMap"]);
                    pageDetails.IncludeInSearchMap = Convert.ToBoolean(reader["IncludeInSearchMap"]);
                    pageDetails.IsClickable        = Convert.ToBoolean(reader["IsClickable"]);
                    pageDetails.ShowHomeCrumb      = Convert.ToBoolean(reader["ShowHomeCrumb"]);
                    pageDetails.RequireSsl         = Convert.ToBoolean(reader["RequireSSL"]);
                    if (reader["PubDateUtc"] != DBNull.Value)
                    {
                        pageDetails.PubDateUtc = Convert.ToDateTime(reader["PubDateUtc"]);
                    }

                    if (
                        (useFolderForSiteDetection) &&
                        (virtualFolder.Length > 0) &&
                        (pageDetails.Url.StartsWith("~/"))
                        )
                    {
                        pageDetails.Url
                            = pageDetails.Url.Replace("~/", "~/" + virtualFolder + "/");
                        pageDetails.UrlHasBeenAdjustedForFolderSites = true;
                    }

                    if (
                        (useFolderForSiteDetection) &&
                        (virtualFolder.Length > 0) &&
                        (!pageDetails.UseUrl)
                        )
                    {
                        pageDetails.UnmodifiedUrl = "~/Default.aspx?pageid="
                                                    + pageDetails.PageId.ToString(CultureInfo.InvariantCulture);

                        pageDetails.Url
                            = "~/" + virtualFolder + "/Default.aspx?pageid="
                              + pageDetails.PageId.ToString(CultureInfo.InvariantCulture);
                        pageDetails.UseUrl = true;
                        pageDetails.UrlHasBeenAdjustedForFolderSites = true;
                    }


                    pageDetails.OpenInNewWindow          = Convert.ToBoolean(reader["OpenInNewWindow"]);
                    pageDetails.ShowChildPageMenu        = Convert.ToBoolean(reader["ShowChildPageMenu"]);
                    pageDetails.ShowChildPageBreadcrumbs = Convert.ToBoolean(reader["ShowChildBreadCrumbs"]);
                    pageDetails.PageIndex = i;

                    string cf = reader["ChangeFrequency"].ToString();
                    switch (cf)
                    {
                    case "Always":
                        pageDetails.ChangeFrequency = PageChangeFrequency.Always;
                        break;

                    case "Hourly":
                        pageDetails.ChangeFrequency = PageChangeFrequency.Hourly;
                        break;

                    case "Daily":
                        pageDetails.ChangeFrequency = PageChangeFrequency.Daily;
                        break;

                    case "Monthly":
                        pageDetails.ChangeFrequency = PageChangeFrequency.Monthly;
                        break;

                    case "Yearly":
                        pageDetails.ChangeFrequency = PageChangeFrequency.Yearly;
                        break;

                    case "Never":
                        pageDetails.ChangeFrequency = PageChangeFrequency.Never;
                        break;

                    case "Weekly":
                    default:
                        pageDetails.ChangeFrequency = PageChangeFrequency.Weekly;
                        break;
                    }

                    string smp = reader["SiteMapPriority"].ToString().Trim();
                    if (smp.Length > 0)
                    {
                        pageDetails.SiteMapPriority = smp;
                    }

                    if (reader["LastModifiedUTC"] != DBNull.Value)
                    {
                        pageDetails.LastModifiedUtc = Convert.ToDateTime(reader["LastModifiedUTC"]);
                    }

                    pageDetails.PageGuid   = new Guid(reader["PageGuid"].ToString());
                    pageDetails.ParentGuid = new Guid(reader["ParentGuid"].ToString());


                    pageDetails.HideAfterLogin = Convert.ToBoolean(reader["HideAfterLogin"]);

                    pageDetails.SiteGuid     = new Guid(reader["SiteGuid"].ToString());
                    pageDetails.CompiledMeta = reader["CompiledMeta"].ToString();
                    if (reader["CompiledMetaUtc"] != DBNull.Value)
                    {
                        pageDetails.CompiledMetaUtc = Convert.ToDateTime(reader["CompiledMetaUtc"]);
                    }

                    pageDetails.IsPending = Convert.ToBoolean(reader["IsPending"]);

                    pageDetails.PubTeamId             = new Guid(reader["PubTeamId"].ToString());
                    pageDetails.IncludeInChildSiteMap = Convert.ToBoolean(reader["IncludeInChildSiteMap"]);

                    pageDetails.BodyCssClass = reader["BodyCssClass"].ToString();
                    pageDetails.MenuCssClass = reader["MenuCssClass"].ToString();

                    pageDetails.PublishMode = Convert.ToInt32(reader["PublishMode"]);

                    menuPages.Add(pageDetails);
                    i++;
                }
            }

            return(menuPages);
        }
示例#20
0
    protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            #region 显示销量库存录入情况
            int clientid = (int)gv_List.DataKeys[e.Row.RowIndex]["CM_Client_ID"];
            int month    = AC_AccountMonthBLL.GetMonthByDate(DateTime.Today.AddDays(0 - ConfigHelper.GetConfigInt("JXCDelayDays")));

            DataTable dt = SVM_SalesVolumeBLL.GetCountByClient(month, clientid);
            if (dt != null && dt.Rows.Count == 3)
            {
                foreach (DataRow row in dt.Rows)
                {
                    HyperLink link = null;
                    switch (row["Title"].ToString())
                    {
                    case "SaleIn":
                        link = (HyperLink)(e.Row.Cells[0].Controls[0]);
                        break;

                    case "SaleOut":
                        link = (HyperLink)(e.Row.Cells[1].Controls[0]);
                        break;

                    case "Inventory":
                        link = (HyperLink)(e.Row.Cells[2].Controls[0]);
                        break;
                    }
                    if (link != null)
                    {
                        link.Text += "<br/>";
                        if (row["ApprovedCount"] != DBNull.Value && (int)row["ApprovedCount"] > 0)
                        {
                            link.ToolTip += " 已审核:" + row["ApprovedCount"].ToString();
                            link.Text    += "-<font color=red>" + row["ApprovedCount"].ToString() + "</font>";
                        }
                        if (row["SubmitedCount"] != DBNull.Value && (int)row["SubmitedCount"] > 0)
                        {
                            link.ToolTip += " 已提交:" + row["SubmitedCount"].ToString();
                            link.Text    += "-<font color=blue>" + row["SubmitedCount"].ToString() + "</font>";
                        }
                        if (row["InputedCount"] != DBNull.Value && (int)row["InputedCount"] > 0)
                        {
                            link.ToolTip += " 未提交:" + row["InputedCount"].ToString();
                            link.Text    += "-<font color=black>" + row["InputedCount"].ToString() + "</font>";
                        }
                    }
                }
            }
            #endregion
        }
    }
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main(string[] args)
        {
            Console.Title = "NWF Windows服务代理工具!";
            if (!IdentityHelper.IsRunAsAdmin())
            {
                WriteLineColor("注:本程序,需用管理员身份运行!", ConsoleColor.Red);
                Console.Beep();
                while (Console.ReadLine() != "exit")
                {
                    WriteLineColor("注:本程序,需用管理员身份运行!", ConsoleColor.Red);
                    Console.Beep();
                }
            }

            var serviceCfg = ConfigHelper.LoadSysServiceCfg();

            serviceCfg.Filter();



            SysServiceHelper.IsExites(serviceCfg.ServiceName, true);

            Console.WriteLine("请选择对{0}的服务操作!", serviceCfg.ExeFileName);
            Console.WriteLine("请选择,[1]安装服务 [2]卸载服务 [3]重装 [4]退出");
            var rs = int.Parse(Console.ReadLine());


            switch (rs)
            {
            case 1:
                while (SysServiceHelper.IsExites(serviceCfg.ServiceName, true))
                {
                    Console.ReadLine();
                    return;
                }
                SysServiceHelper.InstallConsoleService(serviceCfg);
                //取当前可执行文件路径,加上"s"参数,证明是从windows服务启动该程序
                if (SysServiceHelper.IsExites(serviceCfg.ServiceName))
                {
                    WriteLineColor("安装成功 输入s运行服务!");
                    var inputStr = Console.ReadLine();
                    if (inputStr.Equals("s", StringComparison.OrdinalIgnoreCase))
                    {
                        SysServiceHelper.StartService(serviceCfg.ServiceName);
                    }
                }
                Console.Read();
                break;

            case 2:
                SysServiceHelper.UnInstall(serviceCfg);
                if (!SysServiceHelper.IsExites(serviceCfg.ServiceName))
                {
                    WriteLineColor("卸载成功!");
                }
                Console.Read();
                break;

            case 3:
                SysServiceHelper.UnInstall(serviceCfg);
                if (!SysServiceHelper.IsExites(serviceCfg.ServiceName))
                {
                    SysServiceHelper.InstallConsoleService(serviceCfg);
                }
                if (SysServiceHelper.IsExites(serviceCfg.ServiceName))
                {
                    WriteLineColor("安装成功 输入s运行服务!");
                    var inputStr = Console.ReadLine();
                    if (inputStr.Equals("s", StringComparison.OrdinalIgnoreCase))
                    {
                        SysServiceHelper.StartService(serviceCfg.ServiceName);
                    }
                }
                Console.Read();
                break;

            case 4: break;
            }
        }
示例#22
0
        public void run()
        {
            Console.WriteLine("result:程序开始");
            log.WriteLogFile("程序开始启动:");
            byte[] b = new byte[1];
            //Console.ReadKey();
            com = ConfigHelper.GetAppConfig("COM");
            Console.WriteLine("读取COM口:" + com);
            log.WriteLogFile("读取COM口:" + com);
            sp = new SerialPort(com);
            Program program = null;

            try
            {
                sp.Open();
                log.WriteLogFile("打开端口成功!");
                program = new Program();
                ip      = ConfigHelper.GetAppConfig("ServerIP");
                //String str = "57";
                //调用发送图片流程
                log.WriteLogFile("读取控制卡IP:" + ip);
                program.mcInit();
                boxNo = mc.mcFindBoxByIP(ip);

                mc.mcConnectBox(ip, 8100);
                program.sendMvcFlow("rateLimit");
                int boxno      = mc.mcFindBoxByIP(ip);
                int defaultMcv = mc.mcCreateMcv(program.m_sMcPath, "rateLimit", 160, 160, true, true);
                if (defaultMcv == 0)
                {
                    return;
                }
                mc.mcSetCurMcv(defaultMcv);
                mc.mcSetDefaultMcv(boxno, "rateLimit");
                Console.WriteLine("初始化图片成功");
                log.WriteLogFile("初始化图片成功");
            }
            catch (Exception e)
            {
                Console.WriteLine("打开端口失败!:" + e.ToString());
                log.WriteLogFile("打开端口失败!" + e.ToString());
            }
            try
            {
                while (true)
                {
                    Console.WriteLine("开始接收无线信号数据!");
                    log.WriteLogFile("开始接收无线信号数据!");
                    //打开新的串行端口连接
                    //sp.Open();
                    //丢弃来自串行驱动程序的接受缓冲区的数据
                    sp.DiscardInBuffer();
                    //丢弃来自串行驱动程序的传输缓冲区的数据
                    sp.DiscardOutBuffer();
                    //从串口输入缓冲区读取一些字节并将那些字节写入字节数组中指定的偏移量处
                    sp.Read(b, 0, b.Length);

                    StringBuilder sb = new StringBuilder();

                    for (int i = 0; i < b.Length; i++)
                    {
                        sb.Append(Convert.ToString(b[i]) + "");
                    }

                    Console.WriteLine("接收无线信号数据:" + sb.ToString());
                    log.WriteLogFile("接收无线信号数据:" + sb.ToString());

                    program.invokeSendMvc(sb.ToString());
                    //str = "57";

                    //System.Threading.Thread.Sleep(1000);
                }
            }
            catch (Exception e)
            {
                sp.Close();
                Console.WriteLine("程序错误:" + e.ToString());
                log.WriteLogFile("程序错误:" + e.ToString());
            }
        }
示例#23
0
        public void Execute(IJobExecutionContext context)
        {
            //ICache Cache = null;
            try
            {
                foreach (string saas in ConfigHelper.GetSaasList())
                {
                    try
                    {
                        MyWorkerRequest.CreateHttpContext(saas, "", "");
                        //Cache = CacheFactory.GetCache();
                        VehicleManager vm = new VehicleManager();
                        DataTable      dt = vm.GetNoOrderUnlockVehicles();
                        foreach (DataRow row in dt.Rows)
                        {
                            string vid   = row["ID"].ToString();
                            string name  = row["Name"].ToString();
                            string carId = row["VehicleGPSNum"].ToString();

                            /*string keyid = "vehicle_" + carId;
                             * string json_car=Cache.Get<string>(keyid);
                             * string acc = "";
                             * if (!string.IsNullOrEmpty(json_car))
                             * {
                             *  dynamic jsonObj = DynamicJson.Parse(json_car);
                             *  if (jsonObj.IsDefined("data"))
                             *  {
                             *      foreach (var item in jsonObj.data)
                             *      {
                             *          if (item.IsDefined("acc"))
                             *              acc = item.acc;
                             *      }
                             *  }
                             * }*/

                            double speed = 0.00;
                            double.TryParse(row["CurrentSpeed"].ToString(), out speed);
                            //if (acc =="1"){
                            if (vm.CloseVehicle(vid))
                            {
                                Logger.Info("无单锁车成功,车辆号:" + name);
                            }
                            else
                            {
                                Logger.Info("无单锁车失败,车辆号:" + name);
                            }
                            //}
                        }
                        //Cache.Dispose();
                    }
                    catch
                    {
                        /*if (Cache != null)
                         * {
                         *  Cache.Dispose();
                         * }*/
                        continue;
                    }
                }
            }
            catch
            {
                /*if (Cache != null)
                 * {
                 *  Cache.Dispose();
                 * }*/
                Logger.Info("无单车进行断电锁车(NoOrderLock)失败");
            }
        }
示例#24
0
        private void LoadSettings()
        {
            if (WebConfigSettings.CommerceUseGlobalSettings) //false by default
            {
                paymentGatewayUseTestMode = WebConfigSettings.CommerceGlobalUseTestMode;

                if (paymentGatewayUseTestMode)
                {
                    payPalAPIUsername  = WebConfigSettings.CommerceGlobalPayPalSandboxAPIUsername;
                    payPalAPIPassword  = WebConfigSettings.CommerceGlobalPayPalSandboxAPIPassword;
                    payPalAPISignature = WebConfigSettings.CommerceGlobalPayPalSandboxAPISignature;
                }
                else
                {
                    payPalAPIUsername  = WebConfigSettings.CommerceGlobalPayPalProductionAPIUsername;
                    payPalAPIPassword  = WebConfigSettings.CommerceGlobalPayPalProductionAPIPassword;
                    payPalAPISignature = WebConfigSettings.CommerceGlobalPayPalProductionAPISignature;
                }
            }
            else
            {
                SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();
                if (siteSettings == null)
                {
                    return;
                }

                configPrefix = "Site" + siteSettings.SiteId.ToInvariantString() + "-";

                paymentGatewayUseTestMode
                    = ConfigHelper.GetBoolProperty(configPrefix + PaymentGatewayUseTestModeConfig,
                                                   paymentGatewayUseTestMode);

                if (paymentGatewayUseTestMode)
                {
                    if (ConfigurationManager.AppSettings[configPrefix + PayPalSandboxAPIUsernameConfig] != null)
                    {
                        payPalAPIUsername = ConfigurationManager.AppSettings[configPrefix + PayPalSandboxAPIUsernameConfig];
                    }

                    if (ConfigurationManager.AppSettings[configPrefix + PayPalSandboxAPIPasswordConfig] != null)
                    {
                        payPalAPIPassword = ConfigurationManager.AppSettings[configPrefix + PayPalSandboxAPIPasswordConfig];
                    }

                    if (ConfigurationManager.AppSettings[configPrefix + PayPalSandboxAPISignatureConfig] != null)
                    {
                        payPalAPISignature = ConfigurationManager.AppSettings[configPrefix + PayPalSandboxAPISignatureConfig];
                    }
                }
                else
                {
                    if (ConfigurationManager.AppSettings[configPrefix + PayPalProductionAPIUsernameConfig] != null)
                    {
                        payPalAPIUsername = ConfigurationManager.AppSettings[configPrefix + PayPalProductionAPIUsernameConfig];
                    }

                    if (ConfigurationManager.AppSettings[configPrefix + PayPalProductionAPIPasswordConfig] != null)
                    {
                        payPalAPIPassword = ConfigurationManager.AppSettings[configPrefix + PayPalProductionAPIPasswordConfig];
                    }

                    if (ConfigurationManager.AppSettings[configPrefix + PayPalProductionAPISignatureConfig] != null)
                    {
                        payPalAPISignature = ConfigurationManager.AppSettings[configPrefix + PayPalProductionAPISignatureConfig];
                    }
                }
            }

            didLoadSettings = true;
        }
示例#25
0
        public IActionResult Index()
        {
            #region  序集信息

            var vd = new Home_IndexVD()
            {
                AssemblyModelCollection = new Dictionary <Home_IndexVD_GroupInfo, List <Home_IndexVD_AssemblyModel> >()
            };

            //Senparc.Weixin SDK
            var sdkGitHubUrl = "https://github.com/JeffreySu/WeiXinMPSDK";
            var sdkGroup     = new Home_IndexVD_GroupInfo()
            {
                Title       = "Senparc.Weixin SDK",
                Description = "对应于每一个微信平台的基础 SDK,包含了目前微信平台的绝大部分 API,进行微信开发重点是对这些库的使用。"
            };
            var sdkList = new List <Home_IndexVD_AssemblyModel>();
            sdkList.Add(new Home_IndexVD_AssemblyModel("SDK 公共基础库", "Senparc.Weixin", typeof(Senparc.Weixin.WeixinRegister), gitHubUrl: sdkGitHubUrl));
            sdkList.Add(new Home_IndexVD_AssemblyModel("公众号<br />JSSDK<br />摇一摇周边", "Senparc.Weixin.MP", typeof(Senparc.Weixin.MP.Register), gitHubUrl: sdkGitHubUrl));                                              //DPBMARK TenPay DPBMARK_END
            sdkList.Add(new Home_IndexVD_AssemblyModel("公众号MvcExtension", "Senparc.Weixin.MP.MvcExtension", typeof(Senparc.Weixin.MP.MvcExtension.WeixinResult), "Senparc.Weixin.MP.Mvc", gitHubUrl: sdkGitHubUrl)); //DPBMARK MP DPBMARK_END
            sdkList.Add(new Home_IndexVD_AssemblyModel("小程序", "Senparc.Weixin.WxOpen", typeof(Senparc.Weixin.WxOpen.Register), gitHubUrl: sdkGitHubUrl));                                                            //DPBMARK MiniProgram DPBMARK_END
            sdkList.Add(new Home_IndexVD_AssemblyModel("微信支付", "Senparc.Weixin.TenPay", typeof(Senparc.Weixin.MP.MvcExtension.FixWeixinBugWeixinResult), gitHubUrl: sdkGitHubUrl));                                  //DPBMARK MP DPBMARK_END
            sdkList.Add(new Home_IndexVD_AssemblyModel("开放平台", "Senparc.Weixin.Open", typeof(Senparc.Weixin.Open.Register), gitHubUrl: sdkGitHubUrl));                                                               //DPBMARK Open DPBMARK_END
            //TempData["QYVersion"] = getDisplayVersion(getFileVersionInfo("Senparc.Weixin.QY.dll"));//已经停止更新
            sdkList.Add(new Home_IndexVD_AssemblyModel("企业微信", "Senparc.Weixin.Work", typeof(Senparc.Weixin.Work.Register), gitHubUrl: sdkGitHubUrl));                                                               //DPBMARK Work DPBMARK_END
            vd.AssemblyModelCollection[sdkGroup] = sdkList;


            var aspnetGroup = new Home_IndexVD_GroupInfo()
            {
                Title       = "Senparc.Weixin SDK 的 ASP.NET 运行时基础库",
                Description = "这些库基于 ASP.NET 运行时,依赖 ASP.NET 一些特性完成一系列基于 ASP.NET 及 ASP.NET Core 的操作。<br />" +
                              "分离出这些库的另外一个原因,是为了使 Senparc.Weixin SDK 核心库可以不依赖于 ASP.NET 运行时,<br />" +
                              "以便部署在轻量级的容器等环境中。"
            };
            var aspnetList = new List <Home_IndexVD_AssemblyModel>();
            aspnetList.Add(new Home_IndexVD_AssemblyModel("ASP.NET<br />运行时基础库", "Senparc.Weixin.AspNet", typeof(Senparc.Weixin.AspNet.WeixinRegister), gitHubUrl: sdkGitHubUrl));                                               //AspNet 运行时基础库
            aspnetList.Add(new Home_IndexVD_AssemblyModel("公众号消息中间件", "Senparc.Weixin.MP.Middleware", typeof(Senparc.Weixin.MP.MessageHandlers.Middleware.MessageHandlerMiddlewareExtension), gitHubUrl: sdkGitHubUrl));         //DPBMARK MP DPBMARK_END
            aspnetList.Add(new Home_IndexVD_AssemblyModel("小程序消息中间件", "Senparc.Weixin.WxOpen.Middleware", typeof(Senparc.Weixin.WxOpen.MessageHandlers.Middleware.MessageHandlerMiddlewareExtension), gitHubUrl: sdkGitHubUrl)); //DPBMARK MiniProgram DPBMARK_END
            aspnetList.Add(new Home_IndexVD_AssemblyModel("企业微信消息中间件", "Senparc.Weixin.Work.Middleware", typeof(Senparc.Weixin.Work.MessageHandlers.Middleware.MessageHandlerMiddlewareExtension), gitHubUrl: sdkGitHubUrl));    //DPBMARK Work DPBMARK_END
            vd.AssemblyModelCollection[aspnetGroup] = aspnetList;

            var cacheAndExtensionGroup = new Home_IndexVD_GroupInfo()
            {
                Title       = "Senparc.Weixin SDK 扩展组件",
                Description = "Senparc.Weixin SDK 扩展组件用于提供缓存、WebSocket 等一系列扩展模块,<br />" +
                              "这些模块是盛派官方的一个实现,几乎所有的扩展模块都是严格面向接口开发的,<br />" +
                              "因此,您也可以自行扩展,并对接到微信 SDK 或其他系统中,<br />"
            };
            var cacheAndExtensionList = new List <Home_IndexVD_AssemblyModel>();
            cacheAndExtensionList.Add(new Home_IndexVD_AssemblyModel("Redis 缓存<br />(StackExchange.Redis)", "Senparc.Weixin.Cache.Redis", typeof(Senparc.Weixin.Cache.Redis.Register), gitHubUrl: sdkGitHubUrl)); //DPBMARK Redis DPBMARK_END
            cacheAndExtensionList.Add(new Home_IndexVD_AssemblyModel("Redis 缓存<br />(CsRedis)", "Senparc.Weixin.Cache.CsRedis", typeof(Senparc.Weixin.Cache.CsRedis.Register), gitHubUrl: sdkGitHubUrl));         //DPBMARK CsRedis DPBMARK_END
            cacheAndExtensionList.Add(new Home_IndexVD_AssemblyModel("Memcached 缓存", "Senparc.Weixin.Cache.Memcached", typeof(Senparc.Weixin.Cache.Memcached.Register), gitHubUrl: sdkGitHubUrl));                //DPBMARK Memcached DPBMARK_END
            cacheAndExtensionList.Add(new Home_IndexVD_AssemblyModel("WebSocket 模块", "Senparc.WebSocket", typeof(Senparc.WebSocket.WebSocketConfig), gitHubUrl: sdkGitHubUrl));                                   //DPBMARK WebSocket DPBMARK_END
            vd.AssemblyModelCollection[cacheAndExtensionGroup] = cacheAndExtensionList;

            var neucharGitHubUrl = "https://github.com/Senparc/NeuChar";
            var neucharGroup     = new Home_IndexVD_GroupInfo()
            {
                Title       = "跨平台支持库:Senparc.NeuChar",
                Description = "NeuChar 是盛派提供的一套跨平台服务的标准(例如跨微信公众号、微信小程序、丁丁、QQ小程序、百度小程序,等等),<br />" +
                              "使用一套代码,同时服务多平台。目前 Senparc.Weixin SDK 就是基于 NeuChar 标准在微信领域内的一个实现分支,<br />" +
                              "您也可以使用 NeuChar 扩展到更多的平台。<br />" +
                              "<a href=\"https://www.neuchar.com\" target=\"_blank\">https://www.neuchar.com</a> 是盛派官方提供的一个基于 NeuChar 标准实现的可视化跨平台配置操作平台。"
            };
            var neucharList = new List <Home_IndexVD_AssemblyModel>();
            neucharList.Add(new Home_IndexVD_AssemblyModel("NeuChar 跨平台支持库", "Senparc.NeuChar", typeof(Senparc.NeuChar.ApiBindInfo), gitHubUrl: neucharGitHubUrl));                                                         // NeuChar 基础库
            neucharList.Add(new Home_IndexVD_AssemblyModel("NeuChar APP 以及<br />NeuChar Ending<br />的对接 SDK", "Senparc.NeuChar.App", typeof(Senparc.NeuChar.App.HttpRequestType), gitHubUrl: neucharGitHubUrl));            // NeuChar 基础库
            neucharList.Add(new Home_IndexVD_AssemblyModel("NeuChar 的 ASP.NET<br />运行时支持库", "Senparc.NeuChar.AspNet", typeof(Senparc.NeuChar.Middlewares.MessageHandlerMiddlewareExtension), gitHubUrl: neucharGitHubUrl)); // NeuChar 基础库
            vd.AssemblyModelCollection[neucharGroup] = neucharList;

            var co2netGitHubUrl = "https://github.com/Senparc/Senparc.CO2NET";
            var co2netGroup     = new Home_IndexVD_GroupInfo()
            {
                Title       = "底层公共基础库:Senparc.CO2NET",
                Description = "Senparc.CO2NET 是一个支持 .NET Framework 和 .NET Core 的公共基础扩展库,包含常规开发所需要的基础帮助类。<br />" +
                              "开发者可以直接使用 CO2NET 为项目提供公共基础方法,免去重复准备和维护公共代码的痛苦。<br />" +
                              "您可以在几乎任何项目中使用 CO2NET。"
            };
            var co2netList = new List <Home_IndexVD_AssemblyModel>();
            co2netList.Add(new Home_IndexVD_AssemblyModel("CO2NET 基础库", "Senparc.CO2NET", typeof(CO2NET.Config), gitHubUrl: co2netGitHubUrl));                                                           //CO2NET 基础库版本信息
            co2netList.Add(new Home_IndexVD_AssemblyModel("APM 库", "Senparc.CO2NET.APM", typeof(CO2NET.APM.Config), gitHubUrl: co2netGitHubUrl));                                                        //CO2NET.APM 版本信息
            co2netList.Add(new Home_IndexVD_AssemblyModel("Redis 库<br />(StackExchange.Redis)", "Senparc.CO2NET.Cache.Redis", typeof(Senparc.CO2NET.Cache.Redis.Register), gitHubUrl: co2netGitHubUrl)); //CO2NET.Cache.Redis 版本信息  -- DPBMARK CsRedis DPBMARK_END
            co2netList.Add(new Home_IndexVD_AssemblyModel("Redis 库<br />(CSRedis)", "Senparc.CO2NET.Cache.CsRedis", typeof(Senparc.CO2NET.Cache.CsRedis.Register), gitHubUrl: co2netGitHubUrl));         //CO2NET.Cache.CsRedis 版本信息        -- DPBMARK CsRedis DPBMARK_END
            co2netList.Add(new Home_IndexVD_AssemblyModel("Memcached 库", "Senparc.CO2NET.Cache.Memcached", typeof(Senparc.CO2NET.Cache.Memcached.Register), gitHubUrl: co2netGitHubUrl));                //CO2NET.Cache.Memcached 版本信息               -- DPBMARK Memcached DPBMARK_END
            co2netList.Add(new Home_IndexVD_AssemblyModel("CO2NET 的 ASP.NET<br />运行时支持库", "Senparc.CO2NET.AspNet", typeof(Senparc.CO2NET.AspNet.Register), gitHubUrl: co2netGitHubUrl));                 //CO2NET.AspNet 版本信息
            vd.AssemblyModelCollection[co2netGroup] = co2netList;

            #endregion

            //当前 Sample 版本

            TempData["SampleVersion"] = Home_IndexVD_AssemblyModel.GetDisplayVersion(Assembly.GetExecutingAssembly().GetName().Version);

            //缓存
            //var containerCacheStrategy  = CacheStrategyFactory.GetContainerCacheStrategyInstance();
            var containerCacheStrategy = ContainerCacheStrategyFactory.GetContainerCacheStrategyInstance() /*.ContainerCacheStrategy*/;
            TempData["CacheStrategy"] = containerCacheStrategy.GetType().Name.Replace("ContainerCacheStrategy", "");

            #region DPBMARK MP
            try
            {
                //文档下载版本
                var configHelper = new ConfigHelper();
                var config       = configHelper.GetConfig();
                TempData["NewestDocumentVersion"] = config.Versions.First();
            }
            catch (Exception)
            {
                TempData["NewestDocumentVersion"] = new Senparc.Weixin.MP.Sample.CommonService.Download.Config();
            }
            #endregion  DPBMARK_END

            Weixin.WeixinTrace.SendCustomLog("首页被访问",
                                             string.Format("Url:{0}\r\nIP:{1}", Request.Host, HttpContext.Connection.RemoteIpAddress));
            //or use Header: REMOTE_ADDR

            //获取编译时间
            TempData["BuildTime"] = System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString("yyyyMMdd.HH.mm");

            return(View(vd));
        }
示例#26
0
        public override int Execute(Object o, Hashtable inputData)
        {
            log.InfoFormat(job.KeyCode, "Module {0} received {1} inputs.", name, inputData != null ? inputData.Count.ToString() : "no");
            
            State state = (State)o;            
            int retval = 0;
            int runId = 0;
            double duration = 0;
            config = new ConfigHelper(job.Config);

            if (IfResetOnEachRun)
                ResetOutput();

            PassAlongOutputs(inputData);

            int activityIdStarting = UpdateProcessStatus(Enums.ProcessStatus.Starting, "", (State)o);
            XmlDocument sourceXdoc = new XmlDocument();

            if (inputData.Count > 0)
            {
                PerfTimer hpt = new PerfTimer();
                hpt.Start();

                DataTable dtOut = new DataTable();
                string flags = "-x";

                try
                {
                    string runrepSessionID = String.Empty;
                    loaderResultsStruct loaderReturn = null;
                    Service webServ = null;

                    if (InputToProcess.CompareTo(String.Empty) != 0)
                        sourceXdoc = (XmlDocument)((Hashtable)inputData)[InputToProcess];
                    else
                        sourceXdoc = (XmlDocument)((Hashtable)inputData)[0];

                    if (sourceXdoc != null && sourceXdoc.InnerXml != null && !sourceXdoc.InnerXml.Equals(String.Empty) && sourceXdoc.DocumentElement.FirstChild.ChildNodes.Count > 0)
                    {
                        sourceXdoc.InnerXml = sourceXdoc.InnerXml.Replace("http://www.advent.com/SchemaRevLevel248/Geneva", "http://www.advent.com/SchemaRevLevel371/Geneva");

                        if (nsuri.Equals(String.Empty))
                            nsuri = ((sourceXdoc).DocumentElement).NamespaceURI;
                        int i = 0;

                        Hashtable htXmlData = new Hashtable();
                        Hashtable htUserTranId1Ref = new Hashtable();
                        Hashtable htIdentifierRef = new Hashtable();
                        Hashtable htTypeIndicatorRef = new Hashtable();
                        Hashtable htSubTypeIndicatorRef = new Hashtable();

                        XmlNodeList nodeList = null;

                        if (sourceXdoc.DocumentElement.FirstChild.Name.Equals("GenevaLoader"))
                            nodeList = sourceXdoc.DocumentElement.FirstChild.ChildNodes;
                        else
                            nodeList = sourceXdoc.DocumentElement.ChildNodes;

                        string dataType = sourceXdoc.DocumentElement.FirstChild.Name;

                        foreach (XmlNode node in nodeList)
                        {
                            string loaderType = String.Empty;
                            string loaderAction = String.Empty;
                            string userTranId1 = String.Empty;
                            string identifier = String.Empty;
                            foreach (XmlNode subNode in node.ChildNodes)
                            {
                                XmlDocument xdocXmlData = new XmlDocument();
                                XmlNode rootXmlData = xdocXmlData.CreateElement(recordType);
                                xdocXmlData.AppendChild(rootXmlData);

                                string[] loaderKeys = subNode.Name.Split('_');
                                loaderType = loaderKeys[0];
                                if (loaderKeys.Length > 1)
                                    loaderAction = loaderKeys[1];
                                else
                                    loaderAction = "InsertUpdate";

                                recCountTotal = subNode.ChildNodes.Count;

                                GetGenevaTransactionKeys(htUserTranId1Ref, htTypeIndicatorRef, ref loaderType, ref loaderAction, ref userTranId1, ref identifier, subNode, loaderKeys);

                                XmlNode subNodeCopy = xdocXmlData.CreateElement(subNode.Name);
                                subNodeCopy.InnerXml = subNode.InnerXml;
                                xdocXmlData.FirstChild.AppendChild(subNodeCopy);

                                if (!htSubTypeIndicatorRef.Contains(identifier))
                                    htSubTypeIndicatorRef.Add(identifier, loaderAction + "Type");

                                htXmlData.Add(i, ConvertXmlData(xdocXmlData));
                                htIdentifierRef.Add(i, identifier);

                                i++;
                            }
                        }

                        try
                        {
                            ifRetry = true;
                            int numtries = 1;
                            bool isContingency = false;
                            DateTime runStartTime = DateTime.Now;

                            GetSubAdvisorActivityName(state, ref activityName);
                            runId = AddActivityRun(activityName, state.SourceFileName, sourceXdoc.DocumentElement.FirstChild.ChildNodes.Count);

                            while (ifRetry)
                            {
                                try
                                {
                                    webServ = null;
                                    while (webServ == null && numtries < 12)
                                    {
                                        log.InfoFormat(job.KeyCode, "Attempting Geneva SOAP RunCallableLoader [retry #{3}] on {0}:{1} with flags {2}", host, port, flags, numtries);
                                        webServ = new Service();
                                        if (webServ == null)
                                            Thread.Sleep(5000);
                                        numtries++;
                                    }

                                    if (webServ == null)
                                    {
                                        log.ErrorFormat(job.KeyCode, "Web service not constructed (null value)");
                                        retval = -1;
                                        throw new System.Web.Services.Protocols.SoapException();
                                    }
                                    else
                                    {
                                        log.InfoFormat(job.KeyCode, "Web service constructed successfully");

                                        webServ.Timeout = timeout;
                                        log.InfoFormat(job.KeyCode, "Web service timeout assigned: {0}", timeout);

                                        webServ.Url = ConfigUtils.MetaTagReplacer(url);
                                        log.InfoFormat(job.KeyCode, "Web url assigned: {0}", webServ.Url);

                                        if (runrepSessionID.Equals(String.Empty))
                                            try
                                            {
                                                runrepSessionID = webServ.StartCallableLoader(port, host, uid, pwd);
                                                log.InfoFormat(job.KeyCode, "Runrep session started successfully [Runrep ID: {0}]", runrepSessionID);
                                            }
                                            catch (Exception ex)
                                            {
                                                log.WarnFormat(job.KeyCode, "Failed to start runrep session: {0} [Runrep ID: {1}]", ex, runrepSessionID);
                                                retval = -1;
                                                throw new System.Web.Services.Protocols.SoapException();
                                            }
                                    }

                                    try
                                    {
                                        loaderReturn = webServ.RunCallableLoader(runrepSessionID, sourceXdoc.InnerXml, flags);
                                        log.InfoFormat(job.KeyCode, "Callable Loader session was successful [Runrep ID: {0}]", runrepSessionID);

                                        DataTable dtResults = new DataTable();
                                        dtResults.Columns.Add("Status");
                                        dtResults.Columns.Add("Message");
                                        dtResults.Columns.Add("KeyValue");

                                        for (int j = 0; j < loaderReturn.results.Length; j++)
                                        {
                                            DataRow dr = dtResults.NewRow();
                                            dr["Status"] = loaderReturn.results[j].status.ToString();
                                            dr["Message"] = loaderReturn.results[j].message.ToString();
                                            dr["KeyValue"] = loaderReturn.results[j].keyValue.ToString();
                                            dtResults.Rows.Add(dr);
                                        }
                                        dtResults.DefaultView.Sort = "Status,Message,KeyValue";
                                        mailEnvelop = String.Empty;
                                        string lastStatus = "";
                                        string lastmsgg = "";
                                        foreach (DataRowView dr in dtResults.DefaultView)
                                        {
                                            if (!dr["Status"].ToString().Equals(lastStatus))
                                            {
                                                mailEnvelop += String.Format("Status: {0}<br>", dr["Status"].ToString());
                                                lastStatus = dr["Status"].ToString();
                                            }

                                            if (!dr["Message"].ToString().Equals(lastmsgg))
                                            {
                                                mailEnvelop += String.Format("&nspc;&nspc;&nspc;Message: {0}<br>", dr["Message"].ToString());
                                                lastmsgg = dr["Message"].ToString();
                                            }

                                            mailEnvelop += String.Format("&nspc;&nspc;&nspc;&nspc;&nspc;&nspc;ID: {0}<br>", dr["KeyValue"].ToString());
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        log.ErrorFormat(job.KeyCode, "Failed to run Callable Loader session: {0} [Runrep ID: {1}]", ex, runrepSessionID);
                                        retval = -1;
                                        throw new System.Web.Services.Protocols.SoapException();
                                    }

                                    if (isContingency)
                                        SendMailMessage(job.KeyCode, ListTo, ListFrom, Subject, "Geneva SOAP call succeeded.");

                                    try
                                    {
                                        webServ.ShutdownCallableSession(runrepSessionID);
                                        retval = -1;
                                        log.InfoFormat(job.KeyCode, "Shut down SOAP session OK {0}.", runrepSessionID);
                                    }
                                    catch (Exception ex)
                                    {
                                        log.WarnFormat(job.KeyCode, "Error shutting down SOAP session: {0} [Runrep ID: {1}]", ex, runrepSessionID);
                                    }

                                    recCountSuccess++;
                                    ifRetry = false;
                                }

                                catch (Exception wex)
                                {
                                    try
                                    {
                                        webServ.ShutdownCallableSession(runrepSessionID);
                                        retval = -1;
                                        log.InfoFormat(job.KeyCode, "Shut down SOAP session OK {0}.", runrepSessionID);
                                    }
                                    catch (Exception ex)
                                    {
                                        log.WarnFormat(job.KeyCode, "Error shutting down SOAP session: {0} [Runrep ID: {1}]", ex, runrepSessionID);
                                    }

                                    if (wex.Message.IndexOf("Unknown element") > -1)
                                        throw (new ApplicationException(wex.Message));

                                    if (DateTime.Now.CompareTo(runStartTime.AddMinutes(minutesSoapRetry)) < 0)
                                    {
                                        isContingency = true;
                                        runrepSessionID = String.Empty;
                                        ifRetry = ifOverrideSoapErrorRetry ? false : true;
                                        if (!ListTo.Equals(String.Empty))
                                            SendMailMessage(job.KeyCode, ListTo, ListFrom, Subject, wex.ToString());
                                        retval = -1;

                                        Thread.Sleep(60000);
                                    }
                                    else
                                    {
                                        log.ErrorFormat(job.KeyCode, "Geneva SOAP call timed out. Giving up now.");
                                        SendMailMessage(job.KeyCode, ListTo, ListFrom, Subject, "Geneva SOAP call timed out. Giving up now.");
                                        ifRetry = false;
                                        retval = -99;
                                    }
                                }
                            }
                        }
                        catch (Exception exl)
                        {
                            log.Warn(job.KeyCode, exl);
                            retval = -1;
                        }
                        finally
                        {
                            if (loaderReturn != null)
                            {
                                UpdateActivityRun(runId, activityName, dataType, state.SourceFileName, sourceXdoc.DocumentElement.FirstChild.ChildNodes.Count,
                                    loaderReturn, htIdentifierRef, htUserTranId1Ref, htTypeIndicatorRef, htXmlData);
                            }
                            else
                                log.WarnFormat(job.KeyCode, "{0} is not set up in Geneva as valid Activity.", activityName);
                        }
                    }
                }
                catch (Exception ex)
                {
                    log.ErrorFormat(job.KeyCode, "Error : {0}", ex);
                    retval = -99;
                }

                hpt.Stop();
                duration = hpt.Duration;
            }

            AddToOutputs(this.Name, sourceXdoc);
            AddToOutputs(this.Name + "MailEnvelop", mailEnvelop);

            int activityIdEnding = UpdateProcessStatus(Enums.ProcessStatus.Success, "", (State)o );
            UpdateRecordCount(activityIdEnding, recCountTotal, recCountSuccess, recCountFailed);

            log.InfoFormat(job.KeyCode, "GenevaSoapSelect {0} processed {1} of {2} records in {1} seconds.", Name, recCountSuccess, recCountTotal, duration);

            return retval;
        }
示例#27
0
        public void SaveSale(SaleModel saleInfo, string cashierId)
        {
            //TODO: Make this SOLID/DRY/Better
            // Start filling in the sale detail models we will save to the database
            List <SaleDetailDBModel> details = new List <SaleDetailDBModel>();
            ProductData products             = new ProductData(_config);
            var         taxRate = ConfigHelper.GetTaxRate() / 100;

            foreach (var item in saleInfo.SaleDetails)
            {
                var detail = new SaleDetailDBModel
                {
                    ProductId = item.ProductId,
                    Quantity  = item.Quantity
                };

                // Get the information about this product
                var productInfo = products.GetProductById(detail.ProductId);

                if (productInfo == null)
                {
                    throw new Exception($"The product Id of { detail.ProductId } could not be found in the database.");
                }

                detail.PurchasePrice = (productInfo.RetailPrice * detail.Quantity);

                if (productInfo.IsTaxable)
                {
                    detail.Tax = (detail.PurchasePrice * taxRate);
                }

                details.Add(detail);
            }

            // Create the Sale model
            SaleDBModel sale = new SaleDBModel
            {
                SubTotal  = details.Sum(x => x.PurchasePrice),
                Tax       = details.Sum(x => x.Tax),
                CashierId = cashierId
            };

            sale.Total = sale.SubTotal + sale.Tax;

            using (SqlDataAccess sql = new SqlDataAccess(_config))
            {
                try
                {
                    sql.StartTransaction("TRMData");

                    // Save the sale model
                    sql.SaveDataInTransaction("dbo.spSale_Insert", sale);

                    // Get the ID from the sale mode
                    sale.Id = sql.LoadDataInTransaction <int, dynamic>("spSale_Lookup", new { sale.CashierId, sale.SaleDate }).FirstOrDefault();

                    // Finish filling in the sale detail models
                    foreach (var item in details)
                    {
                        item.SaleId = sale.Id;
                        // Save the sale detail models
                        sql.SaveDataInTransaction("dbo.spSaleDetail_Insert", item);
                    }

                    sql.CommitTransaction();
                }
                catch
                {
                    sql.RollbackTransaction();
                    throw;
                }
            }
        }
示例#28
0
        public void Execute(IJobExecutionContext context)
        {
            try
            {
                CancellationToken ct = (CancellationToken)context.JobDetail.JobDataMap["CanellationTokenParam"];
                ct.ThrowIfCancellationRequested();

                SystemConfigEntity systemConfig = sysConfigService.FindSystemConfig((int)SystemConfigs.FtpUpoladService);
                if (systemConfig == null || systemConfig.Status == 0)
                {
                    return;
                }


                FtpConfigEntity ftpConfig = ftpService.GetFirstFtpInfo();
                if (ftpConfig == null)
                {
                    throw new Exception("传8未配置FTP信息");
                }

                if (!Directory.Exists(ftpConfig.ExportFileDirectory))
                {
                    throw new Exception($"传8配置的FTP目录[{ftpConfig.ExportFileDirectory}]不存在");
                }

                string fileBackupPath = Path.Combine(AppPath.DataFolder, ConfigHelper.GetConfig("UploadFileBackpath", "UploadFileBackup"), DateTime.Now.ToString("yyyyMM"));

                if (!Directory.Exists(fileBackupPath))
                {
                    Directory.CreateDirectory(fileBackupPath);
                }

                //获得源文件下所有文件
                List <string> files = new List <string>(Directory.GetFiles(ftpConfig.ExportFileDirectory));
                ct.ThrowIfCancellationRequested();

                files.ForEach(sourceFile =>
                {
                    ct.ThrowIfCancellationRequested();
                    try
                    {
                        FtpHelper.UploadFile(ftpConfig, sourceFile);
                        string backupfileFullpath = Path.Combine(fileBackupPath, FileHelper.GetFileName(sourceFile));

                        //备份上传文件
                        FileHelper.CopyFile(sourceFile, backupfileFullpath);
                        Thread.Sleep(200);
                        File.Delete(sourceFile);

                        LogUtil.WriteLog($"数据文件[{sourceFile}]上传成功");
                    }
                    catch (Exception ex)
                    {
                        LogUtil.WriteLog(ex.Message);
                    }
                });
            }
            catch (Exception ex)
            {
                //JobExecutionException jex = new JobExecutionException(ex);
                //jex.RefireImmediately = true;
                LogUtil.WriteLog($"FtpJob作业类异常,异常信息[{ex.Message}][{ex.StackTrace}]");
            }
        }
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (this.upperRightCloseButton.containsPoint(x, y))
            {
                UnloadMenu(playSound);
            }

            if (this._optionsIcon.containsPoint(x, y))
            {
                var optionsMenu = new OptionsMenu <ModConfigOptions>(_helper, 500, 325, PlayerId, ConfigHelper.GetOptions());

                Game1.activeClickableMenu = optionsMenu;
            }


            base.receiveLeftClick(x, y, playSound);
        }
示例#30
0
        private static SiteSettings LoadSiteSettings()
        {
            if (debugLog)
            {
                log.Debug("CacheHelper.cs LoadSiteSettings");
            }

            SiteSettings siteSettings = null;

            try
            {
                bool useFolderForSiteDetection = ConfigHelper.GetBoolProperty("UseFoldersInsteadOfHostnamesForMultipleSites", false);

                string siteFolderName;
                if (useFolderForSiteDetection)
                {
                    siteFolderName = VirtualFolderEvaluator.VirtualFolderName();
                }
                else
                {
                    siteFolderName = string.Empty;
                }

                if (useFolderForSiteDetection)
                {
                    Guid siteGuid = SiteFolder.GetSiteGuid(siteFolderName);
                    siteSettings = new SiteSettings(siteGuid);
                }
                else
                {
                    siteSettings = new SiteSettings(WebUtils.GetHostName());
                }

                if (siteSettings.SiteId > -1)
                {
                    siteSettings.ReloadExpandoProperties();
                    siteSettings.SiteRoot = WebUtils.GetSiteRoot();
                    if (useFolderForSiteDetection)
                    {
                        siteSettings.SiteFolderName = siteFolderName;
                    }
                }
                else
                {
                    siteSettings = null;
                    log.Error("CacheHelper failed to load siteSettings");
                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error("Error trying to obtain siteSettings", ex);
            }
            catch (InvalidOperationException ex)
            {
                log.Error("Error trying to obtain siteSettings", ex);
            }
            catch (IndexOutOfRangeException ex)
            {
                log.Error("Error trying to obtain siteSettings", ex);
            }

            return(siteSettings);
        }
示例#31
0
 private void setInfo()
 {
     txtName.Text = ConfigHelper.GetAppString("BestopLink").ToString().Trim();
 }
示例#32
0
 public ContractController()
 {
     db = new LogContext(ConfigHelper.GetConnectionString("LogContext"));
     accessInfoService = new AccessInfoService(db);
 }
示例#33
0
        /// <summary>
        /// 從配置文件中獲取發件人信息
        /// </summary>
        public MailHelper()
        {
            //try
            //{
                arryMailTo.Clear();
                //MysqlConnectionString = ConfigurationManager.AppSettings["MySqlConnectionString"];
                ConfigHelper helper = new ConfigHelper();
                MysqlConnectionString = helper.GetConnString();
                //string xmlPath = ConfigurationManager.AppSettings["SiteConfig"];//郵件服務器的設置
                //string path = System.Web.HttpContext.Current.Server.MapPath(xmlPath);
                MailFromAddress = System.Configuration.ConfigurationManager.AppSettings["EmailFrom"].ToString();
                MailHost = System.Configuration.ConfigurationManager.AppSettings["SmtpHost"].ToString();
                MailPort = System.Configuration.ConfigurationManager.AppSettings["SmtpPort"].ToString();
                MailFromUser = System.Configuration.ConfigurationManager.AppSettings["EmailUserName"].ToString();
                MailFormPwd = System.Configuration.ConfigurationManager.AppSettings["EmailPassWord"].ToString();
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine("提示錯誤(判斷是否存在錯誤,數據是否異常):");
            //    Console.WriteLine("MysqlConnectionString值為:" + MysqlConnectionString);
            //    Console.WriteLine("MailFromAddress值為:" + MailFromAddress);
            //    Console.WriteLine("MailHost值為:" + MailHost);
            //    Console.WriteLine("MailPort值為:" + MailPort);
            //    Console.WriteLine("MailFromUser值為:" + MailFromUser);
            //    Console.WriteLine("MailFormPwd值為:" + MailFormPwd);
            //    Console.WriteLine("系統提示錯誤:");
            //    Console.WriteLine(ex);
            //    Console.ReadKey();
            //}

        }
示例#34
0
    // Start is called before the first frame update
    void Start()
    {
        Instance     = this;
        CombatEntity = Entity.CreateWithParent <CombatEntity>(CombatContext.Instance);
        CombatEntity.AddComponent <SkillPreviewComponent>();
        //CombatEntity.GetComponent<MotionComponent>().Enable = false;

#if EGAMEPLAY_EXCEL
        var          config  = ConfigHelper.Get <SkillConfig>(1001);
        SkillAbility ability = CombatEntity.AttachSkill <SkillAbility>(config);
        CombatEntity.BindSkillInput(ability, KeyCode.Q);

        config  = ConfigHelper.Get <SkillConfig>(1002);
        ability = CombatEntity.AttachSkill <SkillAbility>(config);
        CombatEntity.BindSkillInput(ability, KeyCode.W);

        config  = ConfigHelper.Get <SkillConfig>(1004);
        ability = CombatEntity.AttachSkill <SkillAbility>(config);
        CombatEntity.BindSkillInput(ability, KeyCode.E);
#else
        SkillConfigObject config  = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1001_黑火球术");
        SkillAbility      ability = CombatEntity.AttachSkill <SkillAbility>(config);
        CombatEntity.BindSkillInput(ability, KeyCode.Q);

        config  = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1002_炎爆");
        ability = CombatEntity.AttachSkill <SkillAbility>(config);
        CombatEntity.BindSkillInput(ability, KeyCode.W);

        config  = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1004_血红激光炮");
        ability = CombatEntity.AttachSkill <SkillAbility>(config);
        CombatEntity.BindSkillInput(ability, KeyCode.E);

        config  = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1005_火弹");
        ability = CombatEntity.AttachSkill <SkillAbility>(config);
        CombatEntity.BindSkillInput(ability, KeyCode.R);
#endif
        for (int i = InventoryPanelTrm.childCount; i > 0; i--)
        {
            GameObject.Destroy(InventoryPanelTrm.GetChild(i - 1).gameObject);
        }
        var allItemConfigs = ConfigHelper.GetAll <EquipmentConfig>();
        foreach (var item in allItemConfigs)
        {
            var itemObj = GameObject.Instantiate(ItemPrefab);
            itemObj.transform.parent = InventoryPanelTrm;
            itemObj.transform.Find("Icon").GetComponent <UnityEngine.UI.Image>().sprite = Resources.Load <Sprite>($"Icons/{item.Value.Name}");
            var text = itemObj.transform.Find("Text").GetComponent <UnityEngine.UI.Text>();
            text.text = $"+{item.Value.Value}";
            if (item.Value.Attribute == "AttackPower")
            {
                text.color = Color.red;
            }
            itemObj.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => {
                if (EquipmentPanelTrm.childCount >= 4)
                {
                    return;
                }
                var equipObj = GameObject.Instantiate(ItemPrefab);
                equipObj.transform.parent = EquipmentPanelTrm;
                equipObj.transform.Find("Icon").GetComponent <UnityEngine.UI.Image>().sprite = Resources.Load <Sprite>($"Icons/{item.Value.Name}");
                var equipText  = equipObj.transform.Find("Text").GetComponent <UnityEngine.UI.Text>();
                equipText.text = $"+{item.Value.Value}";
                if (item.Value.Attribute == "AttackPower")
                {
                    equipText.color = Color.red;
                }
                var itemData      = Entity.CreateWithParent <ItemData>(CombatEntity);
                equipObj.name     = $"{itemData.Id}";
                itemData.ConfigId = item.Value.Id;
                CombatEntity.AddItemData(itemData);
                equipObj.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => {
                    var id = long.Parse(equipObj.name);
                    CombatEntity.RemoveItemData(id);
                    GameObject.Destroy(equipObj);
                });
            });
        }

        AnimTimer.MaxTime = AnimTime;
    }
示例#35
0
        private void InitLouPanData(int buildingId)
        {
            bId = buildingId;
            //bId = DAL.DataRepository.Instance.GetBuildingsList(DAL.GlobalDataPool.Instance.Uid, 1, 1, 1, null).data.First().ID;
            var buildingInfo = DAL.DataRepository.Instance.GetBuildingsInfo(DAL.GlobalDataPool.Instance.Uid, buildingId).data;

            if (buildingInfo == null)
            {
                return;
            }
            //var v = buildingInfo.Images.First().ImageUrl;
            //iamge.Source = new BitmapImage(new Uri(buildingInfo.Images.First().ImageUrl));

            FlipView2nd.ItemsSource = from a in buildingInfo.Images.OrderBy(a => a.ImageIndex)
                                      select new Uri(ConfigHelper.GetAppSetting("ApiUrl") + @"Images/" + a.ImageUrl, UriKind.Absolute);
            //FlipView2nd.ItemsSource = new Uri[]
            //                 {
            //                     new Uri("http://www.public-domain-photos.com/free-stock-photos-4/landscapes/mountains/painted-desert.jpg", UriKind.Absolute),
            //                     new Uri("http://www.public-domain-photos.com/free-stock-photos-3/landscapes/forest/breaking-the-clouds-on-winter-day.jpg", UriKind.Absolute),
            //                     new Uri("http://www.public-domain-photos.com/free-stock-photos-4/travel/bodie/bodie-streets.jpg", UriKind.Absolute)
            //                 };

            buildingsName = buildingInfo.Name;
            bName.Text    = (string.IsNullOrWhiteSpace(buildingInfo.QuYu) ? "区域未知" : buildingInfo.QuYu) + "  |  "
                            + (string.IsNullOrWhiteSpace(buildingInfo.Name) ? "楼盘名未知" : buildingInfo.Name);

            prise.Text   = string.IsNullOrWhiteSpace(buildingInfo.Price) ? "?元/平米" : buildingInfo.Price;
            address.Text = string.IsNullOrWhiteSpace(buildingInfo.Address) ? "地址未知" : buildingInfo.Address;

            kehushuliang.Text = "合作经济人:" + buildingInfo.HeZhuoJingJiRenNumber
                                + "  |  " + "意向客户:" + buildingInfo.YiXiangKeHuNumber
                                + "  |  " + "我的客户:" + buildingInfo.WoDeKeHuNumber;

            yongjing.Text = buildingInfo.YongJin;

            daikan.Text = buildingInfo.DaiKanYongJin;

            var user = buildingInfo.Users.Where(p => p.UserType == 1).First();

            zhiyeguwen.Text = "咨询业务员    " + user.UserName + "  " + user.DianHua;
            //buildingInfo.yew

            yongjing2.Text = "佣金:" + buildingInfo.YongJin;


            //buildingInfo.HuXing.First ().Name

            BaoBeiGuiZe.Text = string.IsNullOrWhiteSpace(buildingInfo.KaiFaShangGuiZhe.BaoBeiGuiZhe)
                ? "暂无数据" : buildingInfo.KaiFaShangGuiZhe.BaoBeiGuiZhe;
            DiaKanGuiZe.Text = string.IsNullOrWhiteSpace(buildingInfo.KaiFaShangGuiZhe.DaiKanGuiZhe)
                ? "暂无数据" : buildingInfo.KaiFaShangGuiZhe.BaoBeiGuiZhe;
            ChengJiaoGuiZe.Text = string.IsNullOrWhiteSpace(buildingInfo.KaiFaShangGuiZhe.ChengJiaoGuiZhe)
                ? "暂无数据" : buildingInfo.KaiFaShangGuiZhe.BaoBeiGuiZhe;
            ChengJiaoJiangLi.Text = string.IsNullOrWhiteSpace(buildingInfo.KaiFaShangGuiZhe.JiangLi)
                ? "暂无数据" : buildingInfo.KaiFaShangGuiZhe.BaoBeiGuiZhe;
            JieSuanZhouQi.Text = string.IsNullOrWhiteSpace(buildingInfo.KaiFaShangGuiZhe.JieShuanZhouQi)
                ? "暂无数据" : buildingInfo.KaiFaShangGuiZhe.BaoBeiGuiZhe;

            listView.ItemsSource = buildingInfo.HuXing;


            KaiPanShiJian.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.KaiPanTime)
                ? "暂无数据" : buildingInfo.XiangQing.KaiPanTime;
            JiaoFangShiJian.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.JiaoFangTime)
                ? "暂无数据" : buildingInfo.XiangQing.JiaoFangTime;
            KaiFaShang.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.KaiFaShang)
                ? "暂无数据" : buildingInfo.XiangQing.KaiFaShang;
            KaiFaShangPinPai.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.KaiFaShangPinPai)
                ? "暂无数据" : buildingInfo.XiangQing.KaiFaShangPinPai;

            WuYeGongShi.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.WuYeGongShi)
               ? "暂无数据" : buildingInfo.XiangQing.WuYeGongShi;
            JianZhuMianJi.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.JianZhuMianJi)
                ? "暂无数据" : buildingInfo.XiangQing.JianZhuMianJi;

            ZhongHuShu.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.ZhongHuShu)
             ? "暂无数据" : buildingInfo.XiangQing.ZhongHuShu;
            RongJiLv.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.RongJiLv)
                ? "暂无数据" : buildingInfo.XiangQing.RongJiLv;

            CheWeiBi.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.CheWeiBi)
            ? "暂无数据" : buildingInfo.XiangQing.CheWeiBi;
            WuYeFei.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.WuYeFei)
                ? "暂无数据" : buildingInfo.XiangQing.WuYeFei;

            JianZhuLeiXing.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.JianZhuLeiXing)
           ? "暂无数据" : buildingInfo.XiangQing.JianZhuLeiXing;
            ZhuangXiuZhongKuang.Text = string.IsNullOrWhiteSpace(buildingInfo.XiangQing.ZhuangXiuZhongKuang)
                ? "暂无数据" : buildingInfo.XiangQing.ZhuangXiuZhongKuang;

            //买点
            listViewLouPanMaiDian.ItemsSource = buildingInfo.MaiDian;

            HuXingShuLiang.Text = buildingInfo.HuXing.Count.ToString();



            listViewHuXingTuiJian.ItemsSource = buildingInfo.HuXing;


            //FlipView3nd.ItemsSource = from a in buildingInfo.HuXing.OrderBy(a => a.ImageIndex)
            //                          select new Uri(ConfigHelper.GetAppSetting("ApiUrl") + @"Images/" + a.ImageUrl, UriKind.Absolute);

            //webBrowserDiTu.Source = new Uri("www.map.baidu.com");

            //TODO
            //webBrowserDiTu.Navigate(string.Format(louPanMapUri, bId));
            //webBrowserDiTu.Document=

            //buildingInfo.XiangQing
            browser         = new CefSharp.Wpf.ChromiumWebBrowser();
            browser.Address = string.Format(louPanMapUri, bId);
            mapGrid.Children.Add(browser);
        }
示例#36
0
 public static string GetRemoteApiUrl()
 {
     return(ConfigHelper.GetAppKeyWithCache(DataKey.RemoteApiForRelease));
 }
示例#37
0
        /// <summary>
        /// 改变样式命令
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AppCommandTheme_Executed(object sender, EventArgs e)
        {
            ICommandSource source = sender as ICommandSource;

            if (source.CommandParameter is string)
            {
                eStyle style = (eStyle)Enum.Parse(typeof(eStyle), source.CommandParameter.ToString());
                // Using StyleManager change the style and color tinting
                if (StyleManager.IsMetro(style))
                {
                    // More customization is needed for Metro
                    // Capitalize App Button and tab
                    //buttonFile.Text = buttonFile.Text.ToUpper();
                    //foreach (BaseItem item in RibbonControl.Items)
                    //{
                    //    // Ribbon Control may contain items other than tabs so that needs to be taken in account
                    //    RibbonTabItem tab = item as RibbonTabItem;
                    //    if (tab != null)
                    //        tab.Text = tab.Text.ToUpper();
                    //}

                    //buttonFile.BackstageTabEnabled = true; // Use Backstage for Metro

                    ribbonControl1.RibbonStripFont = new System.Drawing.Font("Segoe UI", 9.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    if (style == eStyle.Metro)
                    {
                        StyleManager.MetroColorGeneratorParameters = DevComponents.DotNetBar.Metro.ColorTables.MetroColorGeneratorParameters.DarkBlue;
                    }

                    // Adjust size of switch button to match Metro styling
                    //switchButtonItem1.SwitchWidth = 16;
                    //switchButtonItem1.ButtonWidth = 48;
                    //switchButtonItem1.ButtonHeight = 19;

                    // Adjust tab strip style
                    //tabStrip1.Style = eTabStripStyle.Metro;

                    StyleManager.Style = style; // BOOM
                }
                else
                {
                    // If previous style was Metro we need to update other properties as well
                    //if (StyleManager.IsMetro(StyleManager.Style))
                    //{
                    //    ribbonControl1.RibbonStripFont = null;
                    //    // Fix capitalization App Button and tab
                    //    //buttonFile.Text = ToTitleCase(buttonFile.Text);
                    //foreach (BaseItem item in RibbonControl.Items)
                    //{
                    //    // Ribbon Control may contain items other than tabs so that needs to be taken in account
                    //    RibbonTabItem tab = item as RibbonTabItem;
                    //    if (tab != null)
                    //        tab.Text = ToTitleCase(tab.Text);
                    //}
                    //    // Adjust size of switch button to match Office styling
                    //    switchButtonItem1.SwitchWidth = 28;
                    //    switchButtonItem1.ButtonWidth = 62;
                    //    switchButtonItem1.ButtonHeight = 20;
                    //}
                    // Adjust tab strip style
                    //tabStrip1.Style = eTabStripStyle.Office2007Document;
                    StyleManager.ChangeStyle(style, Color.Empty);
                    //if (style == eStyle.Office2007Black || style == eStyle.Office2007Blue || style == eStyle.Office2007Silver || style == eStyle.Office2007VistaGlass)
                    //    buttonFile.BackstageTabEnabled = false;
                    //else
                    //    buttonFile.BackstageTabEnabled = true;
                }
            }
            else if (source.CommandParameter is Color)
            {
                if (StyleManager.IsMetro(StyleManager.Style))
                {
                    StyleManager.MetroColorGeneratorParameters = new DevComponents.DotNetBar.Metro.ColorTables.MetroColorGeneratorParameters(Color.White, (Color)source.CommandParameter);
                }
                else
                {
                    StyleManager.ColorTint = (Color)source.CommandParameter;
                }
            }
            //保存用户设置
            ConfigHelper.UpdateOrCreateAppSetting(ConfigHelper.ConfigurationFile.AppConfig, "FormStyle", source.CommandParameter.ToString());
        }
        public void SaveSale(SaleModel saleInfo, string cashierId)
        {
            // TODO: make this SOLID/DRY/better
            // Start filling in the sale detail models we will save to the db
            List <SaleDetailDBModel> details = new List <SaleDetailDBModel>();
            var taxRate = ConfigHelper.GetTaxRate() / 100;

            foreach (var item in saleInfo.SaleDetails)
            {
                var detail = (new SaleDetailDBModel
                {
                    ProductId = item.ProductId,
                    Quantity = item.Quantity
                });

                // get the info about this product
                var productInfo = _productData.GetProductById(detail.ProductId);

                if (productInfo == null)
                {
                    throw new Exception($"The product ID of {detail.ProductId} could not be found in the database.");
                }

                detail.PurchasePrice = (productInfo.RetailPrice * detail.Quantity);

                if (productInfo.IsTaxable)
                {
                    detail.Tax = (detail.PurchasePrice * taxRate);
                }

                details.Add(detail);
            }
            // fill in the available info
            // create the sale model
            SaleDBModel sale = new SaleDBModel
            {
                SubTotal  = details.Sum(x => x.PurchasePrice),
                Tax       = details.Sum(x => x.Tax),
                CashierId = cashierId
            };

            sale.Total = sale.SubTotal + sale.Tax;

            // C# TRANSACTIONS ---- NOT SQL (use very rarely or not at all)
            // open transactions = bad for memory and more
            // prefferably SQL will handle the transaction

            try
            {
                _sql.StartTransaction("TRMData");

                // save the sale model
                _sql.SaveDataInTransaction("dbo.spSale_Insert", sale);

                // get the id from the sale model
                sale.Id = _sql.LoadDataInTransaction <int, dynamic>("spSale_Lookup", new { CashierId = sale.CashierId, SaleDate = sale.SaleDate }).FirstOrDefault();

                // finish filling in the sale detail models
                foreach (var item in details)
                {
                    item.SaleId = sale.Id;
                    // save the sale detail models
                    _sql.SaveDataInTransaction("dbo.spSaleDetail_Insert", item);
                }

                _sql.CommitTransaction();
            }
            catch
            {
                _sql.RollbackTransaction();
                throw;
            }
        }
示例#39
0
 static ConfigHelper()
 {
     _Instance = new ConfigHelper();
 }
示例#40
0
 public override Map Execute(Map input, ServerFacade sf, ConfigHelper cfg, out bool hasMore, out bool cut)
 {
     hasMore = cut = false;
     var strData = File.ReadAllText(this.GetString("infile"));
     return Map.FromXmlObject(strData).GetMap(this.GetString("path"));
 }
示例#41
0
        private static PageSettings LoadPage(Guid pageGuid)
        {
            SiteSettings siteSettings = GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                return(null);
            }

            bool useFolderForSiteDetection
                = ConfigHelper.GetBoolProperty("UseFoldersInsteadOfHostnamesForMultipleSites", false);
            string virtualFolder;

            if (useFolderForSiteDetection)
            {
                virtualFolder = VirtualFolderEvaluator.VirtualFolderName();
            }
            else
            {
                virtualFolder = string.Empty;
            }


            //PageSettings currentPage = new PageSettings(siteSettings.SiteId, pageID);
            PageSettings currentPage = new PageSettings(pageGuid);

            if (currentPage.SiteId != siteSettings.SiteId)
            {   // probably url manipulation trying to use a pageid that
                // doesn't belong to the site so just return the home page
                currentPage = new PageSettings(siteSettings.SiteId, -1);
            }



            if (
                (useFolderForSiteDetection) &&
                (virtualFolder.Length > 0) &&
                (currentPage.Url.StartsWith("~/"))
                )
            {
                currentPage.Url
                    = currentPage.Url.Replace("~/", "~/" + virtualFolder + "/");

                currentPage.UrlHasBeenAdjustedForFolderSites = true;
            }

            if (
                (useFolderForSiteDetection) &&
                (virtualFolder.Length > 0) &&
                (!currentPage.UseUrl)
                )
            {
                currentPage.Url
                    = "~/" + virtualFolder + "/Default.aspx?pageid="
                      + currentPage.PageId.ToString();
                currentPage.UseUrl = true;
                currentPage.UrlHasBeenAdjustedForFolderSites = true;
            }

            LoadPageModule(currentPage);

            return(currentPage);
        }
 public BackupFolderBlobRepositoryConfig(ConfigHelper configHelper)
 {
     StorageAccountConnectionString = configHelper.GetSetting(STORAGE_ACCOUNT_CONNECTION_STRING, "UseDevelopmentStorage=true");
     ContainerName = configHelper.GetSetting(CONTAINER_NAME, CONTAINER_NAME_DEFAULT);
 }
示例#43
0
 public void BindPlanDetail()
 {
     if (this.MonthPlanID != "" && this.MonthPlanID.Length == 36)
     {
         DataTable dt = new DataTable();
         Fund_Plan_MonthMainInfo fund_Plan_MonthMainInfo = new Fund_Plan_MonthMainInfo();
         fund_Plan_MonthMainInfo = this.FA.GetMainInfoByMonthPlanID(this.MonthPlanID);
         this.ltFlowState.Text   = Common2.GetState(fund_Plan_MonthMainInfo.FlowState.ToString());
         this.ltadduser.Text     = fund_Plan_MonthMainInfo.OperatorName.ToString();
         this.ltadddate.Text     = fund_Plan_MonthMainInfo.OperateTime.ToShortDateString();
         if (fund_Plan_MonthMainInfo.PrjGuid.ToString() != "")
         {
             this.ltprjname.Text = fund_Plan_MonthMainInfo.PrjName.ToString();
         }
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.Append(fund_Plan_MonthMainInfo.PlanYear.ToString()).Append("年");
         stringBuilder.Append(fund_Plan_MonthMainInfo.PlanMonth.ToString()).Append("月");
         stringBuilder.Append("资金");
         this.plantype = fund_Plan_MonthMainInfo.PlanType;
         int num  = fund_Plan_MonthMainInfo.PlanYear;
         int num2 = fund_Plan_MonthMainInfo.PlanMonth;
         num2--;
         if (num2 < 1)
         {
             num2 = 12;
             num--;
         }
         if (!string.IsNullOrEmpty(fund_Plan_MonthMainInfo.Remark))
         {
             this.Literal2.Text = fund_Plan_MonthMainInfo.Remark.ToString();
         }
         string text = string.Empty;
         if (fund_Plan_MonthMainInfo.PlanType == "payout")
         {
             this.hfldAdjunctPath.Value = ConfigHelper.Get("MonthPlanPayOut");
             text = ConfigHelper.Get("MonthPlanPayOut");
             this.showaudit1.BusiCode = "091";
             dt = this.getLastPlan("payout", num2, num, fund_Plan_MonthMainInfo.PrjGuid.ToString());
             stringBuilder.Append("支出");
         }
         else
         {
             text = ConfigHelper.Get("MonthPlanIncome");
             this.hfldAdjunctPath.Value = ConfigHelper.Get("MonthPlanIncome");
             this.showaudit1.BusiCode   = "090";
             dt = this.getLastPlan("income", num2, num, fund_Plan_MonthMainInfo.PrjGuid.ToString());
             stringBuilder.Append("收入");
         }
         text += this.MonthPlanID.ToString();
         string value = string.Empty;
         if (!string.IsNullOrEmpty(text))
         {
             value = text;
             text  = HttpContext.Current.Server.MapPath(text);
         }
         DirectoryUtility directoryUtility = new DirectoryUtility(text);
         List <Annex>     annex            = directoryUtility.GetAnnex();
         ISerializable    serializable     = new JsonSerializer();
         string           a = serializable.Serialize <List <Annex> >(annex);
         StringBuilder    stringBuilder2 = new StringBuilder();
         if (a != "[]")
         {
             for (int i = 0; i < annex.Count; i++)
             {
                 if (annex[i].Name != null && annex[i].Name.ToString() != "")
                 {
                     stringBuilder2.Append("<a class=\"link\" target=\"_blank\" href=\"../../Common/DownLoad.aspx?path=").Append(value).Append("/").Append(annex[i].Name.ToString()).Append("\" title=\"" + HttpContext.Current.Server.UrlDecode(annex[i].Name.ToString()) + "\" >");
                     stringBuilder2.Append(HttpContext.Current.Server.UrlDecode(annex[i].Name.ToString()));
                     stringBuilder2.Append("</a>&nbsp;&nbsp;&nbsp;&nbsp;");
                 }
             }
         }
         this.Literal1.Text = stringBuilder2.ToString();
         stringBuilder.Append("计划");
         this.lblTitle.Text = stringBuilder.ToString();
         DataTable planDetailList = this.FA.GetPlanDetailList(this.MonthPlanID, fund_Plan_MonthMainInfo.PlanType);
         DataTable dataTable      = this.UniteDataTable(planDetailList, new DataTable
         {
             Columns =
             {
                 {
                     "sumtotal",
                     Type.GetType("System.String")
                 }
             },
             Rows =
             {
                 new object[]
                 {
                     ""
                 }
             }
         }, "ce");
         dataTable = this.JoinDataTable(dataTable, dt, "eee");
         this.ViewState["sourcesTable"] = dataTable;
         this.gvwWebLineList.DataSource = dataTable;
         this.gvwWebLineList.DataBind();
         string[] value2 = new string[]
         {
             dataTable.Compute("SUM(PlanMoney)", string.Empty).ToString()
         };
         int[] index = new int[]
         {
             9
         };
         GridViewUtility.AddTotalRow(this.gvwWebLineList, value2, index);
     }
 }
 static MsnSoapSearchCrawler()
 {
     ConfigHelper config = new ConfigHelper(typeof(Crawler));
     AppID = config.GetConfigValue<string>("AppID");
     MsnSearchUrl = config.GetConfigValue<string>("MsnWebServiceUrl");
 }
示例#45
0
        private void FormControl_Load(object sender, EventArgs e)
        {

            //读取配置文件的初始值
            //字体名称
            StrTitleFontName = Settings.Default.TitleFontName;
            StrLyricFontName = Settings.Default.LyricFontName;
            StrPageNumberFontName = Settings.Default.PageNumberFontName;

            //颜色
            ColorTitle = Settings.Default.TitleColor;
            ColorPageNumber = Settings.Default.PageNumberColor;
            ColorLyric = Settings.Default.LyricColor;
            ColorBack = Settings.Default.BackColor;



            //是否显示背景图片
            IsShowBackgroundImage = Settings.Default.IsShowBackgroundImage;
            
            //背景图片
            StrBackgroundImagePath = Settings.Default.BackgroundImagePath;


            //字号
            IntTitleFontSize = Settings.Default.TitleFontSize;
            IntLyricFontSize = Settings.Default.LyricFontSize;
            IntPageNumberFontSize = Settings.Default.PageNumberFontSize;
            //IntLyricLeftSpace = Settings.Default.LyricLeftSpace;

            //加载上次打开的列表
            StrLastMusicianList = Settings.Default.LastMusicianList;
            StrLastAlbumList = Settings.Default.LastAlbumList;


            //FontStyleTitle = Settings.Default.TitleFontStyle;
            switch (Settings.Default.TitleFontStyle)
            {
                case "正常":
                    FontStyleTitle = FontStyle.Regular;
                    break;
                case "加粗":
                    FontStyleTitle = FontStyle.Bold;
                    break;
                case "倾斜":
                    FontStyleTitle = FontStyle.Italic;
                    break;
                default:
                    FontStyleTitle = FontStyle.Regular;
                    break;
            }

            //FontStyleLection = Settings.Default.LectionFontStyle;
            switch (Settings.Default.LyricFontStyle)
            {
                case "正常":
                    FontStyleLyric = FontStyle.Regular;
                    break;
                case "加粗":
                    FontStyleLyric = FontStyle.Bold;
                    break;
                case "倾斜":
                    FontStyleLyric = FontStyle.Italic;
                    break;
                default:
                    FontStyleLyric = FontStyle.Regular;
                    break;
            }

            //字符间距及行间距
            IntFontSpace = Settings.Default.FontSpace;
            IntLineSpace = Settings.Default.LineSpace;

            //是否显示标题
            BoolIsShowTitle = Settings.Default.IsShowTitle;
            if (BoolIsShowTitle == false)
            {
                buttonHideOrShowTitle.Text = "显示标题";
            }
            else
            {
                buttonHideOrShowTitle.Text = "隐藏标题";
            }

            //重新加载画刷等参数
            ReloadConfigParameters();

            _configHelper = new ConfigHelper();


            //显示投影窗口
            ShowScreen();

            //移动投影窗口到右上角
            _formScreen.Left = Screen.GetWorkingArea(this).Right - _formScreen.Width;
            _formScreen.Top = Screen.GetWorkingArea(this).Top;


            #region 初始化控件数据
            //初始化系列列表下拉列表控件
            InitMusicianList();

            //初始化标题字体,经文字体控件
            foreach (System.Drawing.FontFamily i in _objFont.Families)
            {
                comboBoxLyricFontName.Items.Add(i.Name.ToString());
                comboBoxTitleFontName.Items.Add(i.Name.ToString());
            }


            //初始化标题、经文字号
            comboBoxTitleFontSize.Items.Add("12");
            comboBoxTitleFontSize.Items.Add("20");
            comboBoxTitleFontSize.Items.Add("30");
            comboBoxTitleFontSize.Items.Add("35");
            comboBoxTitleFontSize.Items.Add("40");
            comboBoxTitleFontSize.Items.Add("45");
            comboBoxTitleFontSize.Items.Add("50");
            comboBoxTitleFontSize.Items.Add("60");
            comboBoxTitleFontSize.Items.Add("70");
            comboBoxTitleFontSize.Items.Add("80");
            comboBoxTitleFontSize.Items.Add("90");
            comboBoxTitleFontSize.Items.Add("100");
            comboBoxTitleFontSize.Items.Add("110");
            comboBoxTitleFontSize.Items.Add("120");
            comboBoxTitleFontSize.Items.Add("130");
            comboBoxTitleFontSize.Items.Add("140");
            comboBoxTitleFontSize.Items.Add("150");
            comboBoxTitleFontSize.Items.Add("200");


            comboBoxLyricFontSize.Items.Add("12");
            comboBoxLyricFontSize.Items.Add("20");
            comboBoxLyricFontSize.Items.Add("30");
            comboBoxLyricFontSize.Items.Add("35");
            comboBoxLyricFontSize.Items.Add("40");
            comboBoxLyricFontSize.Items.Add("45");
            comboBoxLyricFontSize.Items.Add("50");
            comboBoxLyricFontSize.Items.Add("60");
            comboBoxLyricFontSize.Items.Add("70");
            comboBoxLyricFontSize.Items.Add("80");
            comboBoxLyricFontSize.Items.Add("90");
            comboBoxLyricFontSize.Items.Add("100");
            comboBoxLyricFontSize.Items.Add("110");
            comboBoxLyricFontSize.Items.Add("120");
            comboBoxLyricFontSize.Items.Add("130");
            comboBoxLyricFontSize.Items.Add("140");
            comboBoxLyricFontSize.Items.Add("150");
            comboBoxLyricFontSize.Items.Add("200");


            //初始化标题、经文的字体样式
            //comboBoxLectionFontStyle.Items.Add(FontStyle.Bold.ToString());
            //comboBoxLectionFontStyle.Items.Add(FontStyle.Italic.ToString());
            //comboBoxLectionFontStyle.Items.Add(FontStyle.Regular.ToString());
            //comboBoxLectionFontStyle.Items.Add(FontStyle.Strikeout.ToString());
            //comboBoxLectionFontStyle.Items.Add(FontStyle.Underline.ToString());

            comboBoxLyricFontStyle.Items.Add("正常");
            comboBoxLyricFontStyle.Items.Add("加粗");
            comboBoxLyricFontStyle.Items.Add("倾斜");

            //comboBoxTitleFontStyle.Items.Add(FontStyle.Bold.ToString());
            //comboBoxTitleFontStyle.Items.Add(FontStyle.Italic.ToString());
            //comboBoxTitleFontStyle.Items.Add(FontStyle.Regular.ToString());
            //comboBoxTitleFontStyle.Items.Add(FontStyle.Strikeout.ToString());
            //comboBoxTitleFontStyle.Items.Add(FontStyle.Underline.ToString());

            comboBoxTitleFontStyle.Items.Add("正常");
            comboBoxTitleFontStyle.Items.Add("加粗");
            comboBoxTitleFontStyle.Items.Add("倾斜");


            //初始化行间距
            comboBoxLineSpacing.Items.Add("-100");
            comboBoxLineSpacing.Items.Add("-50");
            comboBoxLineSpacing.Items.Add("-30");
            comboBoxLineSpacing.Items.Add("-20");
            comboBoxLineSpacing.Items.Add("-10");
            comboBoxLineSpacing.Items.Add("-5");
            comboBoxLineSpacing.Items.Add("0");
            comboBoxLineSpacing.Items.Add("5");
            comboBoxLineSpacing.Items.Add("10");
            comboBoxLineSpacing.Items.Add("15");
            comboBoxLineSpacing.Items.Add("20");
            comboBoxLineSpacing.Items.Add("30");
            comboBoxLineSpacing.Items.Add("40");
            comboBoxLineSpacing.Items.Add("50");
            comboBoxLineSpacing.Items.Add("60");
            comboBoxLineSpacing.Items.Add("70");
            comboBoxLineSpacing.Items.Add("80");
            comboBoxLineSpacing.Items.Add("90");
            comboBoxLineSpacing.Items.Add("100");
            comboBoxLineSpacing.Items.Add("150");
            comboBoxLineSpacing.Items.Add("200");
            comboBoxLineSpacing.Items.Add("250");
            comboBoxLineSpacing.Items.Add("300");
            comboBoxLineSpacing.Items.Add("400");
            comboBoxLineSpacing.Items.Add("500");
            comboBoxLineSpacing.Items.Add("600");
            comboBoxLineSpacing.Items.Add("700");


            //初始化字间距
            comboBoxFontSpacing.Items.Add("-100");
            comboBoxFontSpacing.Items.Add("-80");
            comboBoxFontSpacing.Items.Add("-50");
            comboBoxFontSpacing.Items.Add("-20");
            comboBoxFontSpacing.Items.Add("-10");
            comboBoxFontSpacing.Items.Add("-5");
            comboBoxFontSpacing.Items.Add("0");
            comboBoxFontSpacing.Items.Add("5");
            comboBoxFontSpacing.Items.Add("10");
            comboBoxFontSpacing.Items.Add("15");
            comboBoxFontSpacing.Items.Add("20");
            comboBoxFontSpacing.Items.Add("30");
            comboBoxFontSpacing.Items.Add("40");
            comboBoxFontSpacing.Items.Add("50");
            comboBoxFontSpacing.Items.Add("60");
            comboBoxFontSpacing.Items.Add("70");
            comboBoxFontSpacing.Items.Add("80");
            comboBoxFontSpacing.Items.Add("90");
            comboBoxFontSpacing.Items.Add("100");
            comboBoxFontSpacing.Items.Add("150");
            comboBoxFontSpacing.Items.Add("200");
            comboBoxFontSpacing.Items.Add("250");
            comboBoxFontSpacing.Items.Add("300");
            comboBoxFontSpacing.Items.Add("400");
            comboBoxFontSpacing.Items.Add("500");
            comboBoxFontSpacing.Items.Add("600");
            comboBoxFontSpacing.Items.Add("700");


            //comboBoxLyricLeftSpace.Items.Add("-100");
            //comboBoxLyricLeftSpace.Items.Add("-80");
            //comboBoxLyricLeftSpace.Items.Add("-50");
            //comboBoxLyricLeftSpace.Items.Add("-20");
            //comboBoxLyricLeftSpace.Items.Add("-10");
            //comboBoxLyricLeftSpace.Items.Add("-5");
            //comboBoxLyricLeftSpace.Items.Add("0");
            //comboBoxLyricLeftSpace.Items.Add("5");
            //comboBoxLyricLeftSpace.Items.Add("10");
            //comboBoxLyricLeftSpace.Items.Add("20");
            //comboBoxLyricLeftSpace.Items.Add("30");
            //comboBoxLyricLeftSpace.Items.Add("50");
            //comboBoxLyricLeftSpace.Items.Add("70");
            //comboBoxLyricLeftSpace.Items.Add("100");
            //comboBoxLyricLeftSpace.Items.Add("150");
            //comboBoxLyricLeftSpace.Items.Add("200");
            //comboBoxLyricLeftSpace.Items.Add("300");
            //comboBoxLyricLeftSpace.Items.Add("400");


            comboBoxBackgroundImageLayout.Items.Add("适应");
            comboBoxBackgroundImageLayout.Items.Add("平铺");
            comboBoxBackgroundImageLayout.Items.Add("居中");
            comboBoxBackgroundImageLayout.Items.Add("拉伸");
            comboBoxBackgroundImageLayout.Items.Add("无");


            #endregion



            #region 尺寸与颜色,其他默认值

            //用设计器设置这里居然有bug,只好用代码。。。
            //设置panel的最小尺寸
            //this.splitContainer1.Panel2MinSize = 300;
            //this.splitContainer1.Panel1MinSize = 400;


            //画布背景色
            //this.panelLectionContent.BackColor = ColorBack;

            //经文背景色
            //this.richTextBoxLectionContent.BackColor = ColorBack;

            //背景颜色
            this.labelBackColor.BackColor = ColorBack;


            //背景图片
            if (IsShowBackgroundImage)
            {
                checkBoxIsShowBackgroundImage.Checked = true;
            }
            else
            {
                checkBoxIsShowBackgroundImage.Checked = false;
            }



            //标题颜色
            this.labelTitleColor.BackColor = ColorTitle;

            //节号颜色
            this.labelPageNumberColor.BackColor = ColorPageNumber;

            //经文颜色
            this.labelLyricColor.BackColor = ColorLyric;

            //标题、经文字体名称
            comboBoxLyricFontName.Text = StrLyricFontName;
            comboBoxTitleFontName.Text = StrTitleFontName;

            //标题、经文字号控件
            comboBoxLyricFontSize.Text = IntLyricFontSize.ToString();
            comboBoxTitleFontSize.Text = IntTitleFontSize.ToString();

            //标题、经文字样式
            comboBoxTitleFontStyle.Text = Settings.Default.TitleFontStyle;// FontStyleTitle.ToString();
            comboBoxLyricFontStyle.Text = Settings.Default.LyricFontStyle;// FontStyleLection.ToString();

            //行间距
            comboBoxLineSpacing.Text = IntLineSpace.ToString();

            comboBoxFontSpacing.Text = IntFontSpace.ToString();

            //comboBoxLyricLeftSpace.Text = IntLyricLeftSpace.ToString();


            //背景图片位置(布局)
            switch (Settings.Default.BackgroundImageLayout)
            {
                case ImageLayout.Zoom:
                    //适应
                    comboBoxBackgroundImageLayout.Text = "适应";
                    break;
                case ImageLayout.Tile:
                    //平铺
                    comboBoxBackgroundImageLayout.Text = "平铺";

                    break;
                case ImageLayout.Center:
                    //居中
                    comboBoxBackgroundImageLayout.Text = "居中";

                    break;
                case ImageLayout.Stretch:
                    //拉伸
                    comboBoxBackgroundImageLayout.Text = "拉伸";

                    break;
                case ImageLayout.None:
                    //无
                    comboBoxBackgroundImageLayout.Text = "无";

                    break;
                default:
                    comboBoxBackgroundImageLayout.Text = "适应";
                    break;

            }



            //是否忽略换行符
            if (Settings.Default.IsIgnoreReturn)
            {
                checkBoxIsIgnoreReturn.Checked = true;
            }
            else
            {
                checkBoxIsIgnoreReturn.Checked = false;
            }


            //显示歌词
            StrTitle = "";
            StrLyric = "";
            StrPageNumber = "";



            #endregion



            //显示“灵歌推荐”窗体
            formPop = new FormPop();
            formPop.StartPosition = FormStartPosition.Manual;
            formPop.Left = this.Right;
            formPop.Top = this.Top; ;
            //formPop.Show();

            //this.axWindowsMediaPlayer1.settings.autoStart = true;
            //this.axWindowsMediaPlayer1.settings.setMode("Loop", true);


        }
示例#46
0
 protected ContentModule(object content)
 {
     _content = new ConfigHelper<object>(content);
 }
示例#47
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ConfigHelper = new ConfigHelper();
        m_WebLogService = new WebLogService();
        m_PostFactory = new PostFactory();
        m_AuthFactory = new AuthFactory();
        m_CommonFactory = new CommonFactory();
        m_SessionHelper = new SessionHelper();
        m_WebUtility = new WebUtility();
        m_AuthService = m_AuthFactory.GetAuthService();
        m_PostFileService = m_PostFactory.GetPostFileService();
        m_CommonService = m_CommonFactory.GetCommonService();
        m_PostService = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            pnlContent.Visible = false;
            fillGridView();
            ShowMode();
        }
    }
示例#48
0
 public static Dictionary<string, string> Read(string absPath, char separator)
 {
     if (StringHelper.IsNullOrEmpty(absPath))
         throw new IOException("config path is empty");
     ConfigHelper cfg = new ConfigHelper();
     try
     {
         cfg.Content = FileHelper.Read(absPath);
     }
     catch (IOException)
     {
         cfg.Content = "";
     }
     return cfg.ToConfigDic(separator);
 }
示例#49
0
 protected void gvwModelList_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         e.Row.Attributes["id"] = this.gvwWebLineList.DataKeys[e.Row.RowIndex].Value.ToString();
         DataRowView dataRowView = (DataRowView)e.Row.DataItem;
         if (dataRowView["ContractID"].ToString() != "")
         {
             e.Row.Cells[1].Text = this.GetContractNameByContractID(dataRowView["ContractID"].ToString());
         }
         double num  = 0.0;
         double num2 = 0.0;
         if (dataRowView["EarlierMoney"] != null && dataRowView["EarlierMoney"].ToString() != "")
         {
             num2 = double.Parse(dataRowView["EarlierMoney"].ToString());
             e.Row.Cells[6].Text = string.Format("{0:0.000}", num2);
         }
         else
         {
             e.Row.Cells[6].Text = "0.000";
         }
         if (dataRowView["ActuallyMoney"] != null && dataRowView["ActuallyMoney"].ToString() != "")
         {
             num = double.Parse(dataRowView["ActuallyMoney"].ToString());
             e.Row.Cells[7].Text = string.Format("{0:0.000}", num);
         }
         else
         {
             e.Row.Cells[7].Text = "0.000";
         }
         if (num > 0.0 && num2 > 0.0)
         {
             e.Row.Cells[8].Text = string.Format("{0:P}", num / num2 * 100.0 / 100.0);
         }
         else
         {
             e.Row.Cells[8].Text = "0.00%";
         }
         string text = dataRowView["ReMark"].ToString();
         if (text != "" && text.Length > 20)
         {
             e.Row.Cells[10].Text = text.Substring(0, 19) + "......";
         }
         if (dataRowView["BalanceMoney"].ToString() == "")
         {
             e.Row.Cells[4].Text = "0.000";
         }
         if (dataRowView["PaymentMoney"].ToString() == "")
         {
             e.Row.Cells[5].Text = "0.000";
         }
         if (dataRowView["PlanMoney"].ToString() == "")
         {
             e.Row.Cells[9].Text = "0.000";
         }
         string text2 = string.Empty;
         if (this.plantype == "payout")
         {
             text2 = ConfigHelper.Get("MonthPlanPayOut");
         }
         else
         {
             text2 = ConfigHelper.Get("MonthPlanIncome");
         }
         this.hfldAdjunctPath.Value = text2;
         text2 += this.gvwWebLineList.DataKeys[e.Row.RowIndex].Value.ToString();
         DirectoryUtility directoryUtility = new DirectoryUtility(text2);
         List <Annex>     annex            = directoryUtility.GetAnnex();
         ISerializable    serializable     = new JsonSerializer();
         string           a             = serializable.Serialize <List <Annex> >(annex);
         StringBuilder    stringBuilder = new StringBuilder();
         if (a != "[]")
         {
             stringBuilder.Append("<span class=\"link\" onclick=\"queryAdjunct('" + this.gvwWebLineList.DataKeys[e.Row.RowIndex].Value.ToString() + "')\">");
             stringBuilder.Append("<img src='/images1/icon_att0b3dfa.gif' style='cursor: pointer; border-style: none' />");
             stringBuilder.Append("</span>");
         }
         e.Row.Cells[11].Text = stringBuilder.ToString();
         return;
     }
     if (e.Row.RowType != DataControlRowType.Header)
     {
         if (e.Row.RowType == DataControlRowType.Footer)
         {
             e.Row.Cells[0].Text = "aaa";
         }
         return;
     }
     if (this.plantype == "payout")
     {
         e.Row.Cells[2].Text = "乙方";
         e.Row.Cells[5].Text = "合同已付总额";
         e.Row.Cells[6].Text = "上期计划金额";
         e.Row.Cells[7].Text = "<div>上期实际发生金额<img title=\"=合同上期计划已通过资金支付申请审核金额\" style=\"cursor: pointer;\" src=\"/images/help.jpg\" /></div>";
         e.Row.Cells[8].Text = "<div>上期计划执行完成情况 <img title=\"=上期实际发生金额/上期计划金额\" style=\"cursor: pointer;\" src=\"/images/help.jpg\" /></div>";
         return;
     }
     e.Row.Cells[2].Text = "甲方";
     e.Row.Cells[5].Text = "合同已收总额";
     e.Row.Cells[6].Text = "上期计划金额";
     e.Row.Cells[7].Text = "<div>上期实际发生金额<img title=\"=合同上期计划已回款金额\" style=\"cursor: pointer;\" src=\"/images/help.jpg\" /></div>";
     e.Row.Cells[8].Text = "<div>上期计划执行完成情况 <img title=\"=上期实际发生金额/上期计划金额\" style=\"cursor: pointer;\" src=\"/images/help.jpg\" /></div>";
 }
        protected override IEnumerator setup()
        {
            GcsAccessTokenService gcsAccessTokenService = new GcsAccessTokenService(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountName"), new GcsP12AssetFileLoader(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountFile")));

            Service.Set((IGcsAccessTokenService)gcsAccessTokenService);
            string cdnUrl = ContentHelper.GetCdnUrl();
            string cpipeMappingFilename = ContentHelper.GetCpipeMappingFilename();
            CPipeManifestService cpipeManifestService = new CPipeManifestService(cdnUrl, cpipeMappingFilename, gcsAccessTokenService);

            Service.Set((ICPipeManifestService)cpipeManifestService);
            base.gameObject.AddComponent <KeyChainManager>();
            GameSettings gameSettings = new GameSettings();

            Service.Set(gameSettings);
            ContentManifest definition = ContentManifestUtility.FromDefinitionFile("Configuration/embedded_content_manifest");

            Service.Set(new Content(definition));
            Localizer localizer = Localizer.Instance;

            Service.Set(localizer);
            NullCPSwrveService cpSwrveService = new NullCPSwrveService();

            Service.Set((ICPSwrveService)cpSwrveService);
            NetworkServicesConfig networkConfig = NetworkController.GenerateNetworkServiceConfig(TestEnvironment);

            Service.Set((INetworkServicesManager) new NetworkServicesManager(this, networkConfig, offlineMode: false));
            CommerceService commerceService = new CommerceService();

            commerceService.Setup();
            Service.Set(commerceService);
            Service.Set(new MembershipService(null));
            ConnectionManager connectionManager = base.gameObject.AddComponent <ConnectionManager>();

            Service.Set(connectionManager);
            Service.Set(new SessionManager());
            Service.Set(new MixLoginCreateService());
            Service.Set((CPDataEntityCollection) new CPDataEntityCollectionImpl());
            LocalPlayerData localPlayerData = new LocalPlayerData
            {
                name         = "TestPlayer",
                tutorialData = new List <sbyte>()
            };
            PlayerId playerId = (localPlayerData.id = new PlayerId
            {
                id = "999999999999999",
                type = PlayerId.PlayerIdType.SESSION_ID
            });

            Service.Get <CPDataEntityCollection>().ResetLocalPlayerHandle();
            PlayerDataEntityFactory.AddLocalPlayerProfileDataComponents(Service.Get <CPDataEntityCollection>(), localPlayerData);
            LoginController loginController = new LoginController();

            Service.Set(loginController);
            loginController.SetNetworkConfig(networkConfig);
            IntegrationTestEx.FailIf(Service.Get <MixLoginCreateService>().NetworkConfigIsNotSet);
            yield return(null);
        }
        private Uri ResolveBucketUri(WebClientWithTimeout client, Uri uri)
        {
            try
            {
                var helper = new ConfigHelper(client);
                var bucket = helper.ResolveBucket(uri, this.bucketName);
                if (bucket == null)
                    return null;

                var streamingUri = bucket.streamingUri;

                var node = bucket.nodes.FirstOrDefault();

                // beta 2 hack, will be phased out after b3 is released for a while
                if (node != null && node.version == "1.6.0beta2")
                    streamingUri = streamingUri.Replace("/bucketsStreaming/", "/bucketsStreamingConfig/");

                return new Uri(uri, streamingUri);
            }
            catch (Exception e)
            {
                log.Error("Error resolving streaming uri", e);

                return null;
            }
        }
        public BusinessLayerResult <Kullanici> HizliKullaniciKaydi(KullaniciViewModel data)
        {
            Kullanici klnc = Find(x => x.kullaniciAdi == data.Username || x.kullaniciEmail == data.Email);
            BusinessLayerResult <Kullanici> res = new BusinessLayerResult <Kullanici>();

            if (klnc != null)
            {
                if (klnc.kullaniciAdi == data.Username)
                {
                    res.AddError(ErrorMessageCode.UsernameAlreadyExists, "Kullanıcı adı kayıtlı.");
                }
                if (klnc.kullaniciEmail == data.Email)
                {
                    res.AddError(ErrorMessageCode.EmailAlreadyExits, "Email adresi kayıtlı.");
                }
            }
            else if (data.Password != data.Repassword)
            {
                res.AddError(ErrorMessageCode.SifreAynıDegil, "Sifreler uyuşmuyor.");
            }
            else if (data.Password == null || data.Repassword == null)
            {
                res.AddError(ErrorMessageCode.SifreBos, "Sifre alanları boş geçilemez.");
            }
            else
            {
                if (data.Password.Length < 8)
                {
                    res.AddError(ErrorMessageCode.SifreKarakterUzunlugu, "Şifreniz minimum 8 karakter olmalı!");
                }
                else
                {
                    int sayi = 0, buyuk = 0, kucuk = 0, krktr = 0;
                    var sfr = data.Password.ToCharArray();
                    for (int i = 0; i < data.Password.Length; i++)
                    {
                        if (sfr[i] >= 48 && sfr[i] <= 57)
                        {
                            sayi++;
                        }
                        else if (sfr[i] >= 97 && sfr[i] <= 122)
                        {
                            kucuk++;
                        }
                        else if (sfr[i] >= 65 && sfr[i] <= 90)
                        {
                            buyuk++;
                        }
                        else
                        {
                            krktr++;
                        }
                    }
                    if (sayi > 0 && kucuk > 0 && buyuk > 0 && krktr > 0)
                    {
                        int dbResult = Insert(new Kullanici()
                        {
                            kullaniciAdi   = data.Username,
                            kullaniciSifre = data.Password,
                            kullaniciEmail = data.Email,
                            adminmi        = false,
                            activateGuid   = Guid.NewGuid()
                        });
                        if (dbResult > 0)
                        {
                            res.Result = Find(x => x.kullaniciEmail == data.Email && x.kullaniciAdi == data.Username);
                            string siteUri = ConfigHelper.Get <string>("SiteRootUri");
                            //string aktiveUri = $"http://localhost:65089/Kullanici/Aktivasyon/{res.Result.activateGuid}";
                            string aktiveUri = $"{siteUri}/Kullanici/Aktivasyon/{res.Result.activateGuid}";
                            string body      = $"Merhaba {res.Result.kullaniciAdi};<br><br>Hesabınızı aktifleştirmek için <a href='{aktiveUri}' target='_blank'>tıklayınız</a>.";

                            MailHelper.SendMail(body, res.Result.kullaniciEmail, "KAZANÇ LİMANI Hesap Aktifleştirme");
                        }
                    }
                    else
                    {
                        res.AddError(ErrorMessageCode.SifreZorunluKarakterler, "Şifreniz 1 büyük harf, 1 küçük harf, 1 simge( - * _ vb.)'den oluşmalı ve en az 8 karakter olmalıdır!");
                    }
                }
            }
            return(res);
        }
示例#53
0
        public override void Initialize(string name, NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (name == null || String.IsNullOrEmpty(name.Trim()))
            {
                name = "AuthenticationProvider";
            }

            ConfigHelper helper = new ConfigHelper(config);

            config[DESCRIPTION] = helper.contains(DESCRIPTION) ? helper.get(DESCRIPTION) : "Custom Membership Provider";

            ApplicationName = helper.getOrFail(APP_NAME);

            base.Initialize(name, config);

            pMaxInvalidPasswordAttempts = helper.contains(MAX_INVALID_PWD_ATTEMPS) ?
                Convert.ToInt32(helper.get(MAX_INVALID_PWD_ATTEMPS)) : 3;

            pPasswordFormat = MembershipPasswordFormat.Clear;
            pEnablePasswordReset = false;
            pEnablePasswordRetrieval = false;
            pRequiresQuestionAndAnswer = false;
            pRequiresUniqueEmail = false;
            pPasswordAttemptWindow = 0;

            machineKey = ConfigurationManager.GetSection("system.web/machineKey") as MachineKeySection;
            if (machineKey.ValidationKey.Contains("AutoGenerate"))
            {
                if (PasswordFormat != MembershipPasswordFormat.Clear)
                {
                    throw new ConfigurationException("Hashed or Encrypted passwords are not supportedwith auto-generated keys.");
                }
            }
        }
示例#54
0
        void SendLiveMail(IdentityMessage message)
        {
            #region formatter
            string text = string.Format("Please click on this link to {0}: {1}", message.Subject, message.Body);
            string html = "Please confirm your account by clicking this link: <a href=\"" + message.Body + "\">link</a><br/>";

            html += HttpUtility.HtmlEncode(@"Or click on the copy the following link on the browser:" + message.Body);
            #endregion

            MailMessage msg = new MailMessage();
            msg.From = new MailAddress(ConfigHelper.Get <string>("Email"));
            msg.To.Add(new MailAddress(message.Destination));
            msg.Subject = message.Subject;
            msg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(text, null, MediaTypeNames.Text.Plain));
            msg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html));

            SmtpClient smtpClient = new SmtpClient("smtp.live.com", Convert.ToInt32(587)); //smtp.live.com means its a microsoft mail
            System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(ConfigHelper.Get <string>("Email"), ConfigHelper.Get <string>("Password"));
            smtpClient.Credentials = credentials;
            smtpClient.EnableSsl   = true;
            smtpClient.Send(msg);
        }
示例#55
0
 protected ContentModule(DocumentConfig content)
 {
     _content = new ConfigHelper<object>(content);
 }
示例#56
0
        private void Page_Load(object sender, EventArgs e)
        {
            LoadSettings();


            if (!UserCanViewPage(moduleId, Forum.FeatureGuid))
            {
                SiteUtils.RedirectToAccessDeniedPage(this);
                return;
            }

            if (forumId == -1)
            {
                SiteUtils.RedirectToAccessDeniedPage(this);
                return;
            }

            if (forum.ItemId == -1)
            {
                Response.Redirect(SiteRoot);
            }

            if (moduleId != forum.ModuleId)
            {
                SiteUtils.RedirectToAccessDeniedPage(this);
                return;
            }

            if (SiteUtils.IsFishyPost(this))
            {
                SiteUtils.RedirectToAccessDeniedPage(this);
                return;
            }

            if (!WebUser.IsInRoles(forum.RolesThatCanPost))
            {
                if (!Request.IsAuthenticated)
                {
                    SiteUtils.RedirectToLoginPage(this);
                    return;
                }

                SiteUtils.RedirectToAccessDeniedPage(this);
                return;
            }

            // forum could allow "All Users" so isinroles would return true above even though not authenticated
            // if not authenticated then use a captcha
            if (Request.IsAuthenticated)
            {
                pnlAntiSpam.Visible = false;
                captcha.Enabled     = false;
            }


            if ((forum.Closed && !isModerator))
            {
                SiteUtils.RedirectToAccessDeniedPage(this);
                return;
            }

            PopulateLabels();

            if (!Page.IsPostBack)
            {
                PopulateControls();
                if ((Request.UrlReferrer != null) && (hdnReturnUrl.Value.Length == 0))
                {
                    hdnReturnUrl.Value    = Request.UrlReferrer.ToString();
                    lnkCancel.NavigateUrl = Request.UrlReferrer.ToString();
                }
            }

            AnalyticsSection = ConfigHelper.GetStringProperty("AnalyticsForumSection", "forums");
        }
示例#57
0
        /// <summary>
        /// 尝试下载
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public Task<FileResult> Download(string guid)
        {
            return Task.Factory.StartNew<FileResult>(() =>
            {
                var success = CheckCanDownload(guid);
                if (!success)
                {
                    string message = null;
                    var guidNotFound = !ConfigHelper.CodeCollection.ContainsKey(guid);
                    if (guidNotFound)
                    {
                        message = "审核失败,请从官方下载页面进入!";
                    }
                    else
                    {
                        var codeRecord = ConfigHelper.CodeCollection[guid];
                        if (!codeRecord.AllowDownload)
                        {
                            message = string.Format("审核失败,文件不允许下载,或已经下载过!如需重新下载请刷新浏览器!(101 - {0})", guid);
                        }
                    }

                    message = message ?? string.Format("未通过审核,或此二维码已过期,请刷新网页后重新操作!(102 - {0})", guid);

                    var file = File(Encoding.UTF8.GetBytes(message), "text/plain");
                    file.FileDownloadName = "下载失败.txt";
                    return file;
                }
                else
                {
                    var codeRecord = ConfigHelper.CodeCollection[guid];
                    codeRecord.Used = true;
                    //codeRecord.AllowDownload = false;//这里如果只允许一次下载,有的浏览器插件或者防护软件会自动访问页面上的链接,导致用户真实的下载时效
                    var configHelper = new ConfigHelper(this.HttpContext);
                    var filePath = configHelper.Download(codeRecord.Version, codeRecord.IsWebVersion);
                    var file = File(filePath, "application/octet-stream");


                    file.FileDownloadName = string.Format("Senparc.Weixin{0}-v{1}.rar",
                        codeRecord.IsWebVersion?"-Web":"",
                        codeRecord.Version);
                    return file;
                }
            });
        }
示例#58
0
 public FormAccountLogin()
 {
     var defaultConnectionString = ConfigHelper.XmlReadConnectionString("Finance.exe.config", "default");
     DBHelper.DefaultInstance = new DBHelper(defaultConnectionString);
     InitializeComponent();
 }
示例#59
0
        /// <summary>保存到配置文件中去</summary>
        /// <param name="filename">文件名</param>
        public override void Save(string filename)
        {
            if (filename.IsNullOrWhiteSpace())
            {
                filename = DirEx.CurrentDir() + ConfigFile;
            }

            if (filename.IsNullOrWhiteSpace())
            {
                throw new ApplicationException($"未指定{typeof(TConfig).Name}的配置文件路径!");
            }

            ConcurrentDictionary <string, Ident> idents = ConfigHelper.InitIdents(current);

            foreach (var ident in idents.Values)
            {
                if (ident.Section.IsNullOrEmpty())
                {
                    ident.Section = "Setup";
                }
            }

            ConfigHelper.SaveConfigValue(Current, idents);
            List <string> strs = new List <string> {
                ";<!--" + Description + "-->", ""
            };
            Dictionary <string, List <Ident> > listidents = new Dictionary <string, List <Ident> >();

            foreach (var ident in idents.Values)
            {
                string section = ident.IsList ? ident.Section + "-" + ident.Key : ident.Section;

                if (!listidents.ContainsKey(section))
                {
                    listidents.Add(section, new List <Ident>());
                }

                listidents[section].Add(ident);
            }

            foreach (var values in listidents)
            {
                strs.Add("[" + values.Key + "]");

                SortedList <int, Ident> slist = new SortedList <int, Ident>();
                foreach (var ident in values.Value)
                {
                    slist.Add(ident.Index, ident);
                }

                foreach (var ident in slist.Values)
                {
                    if (!ident.Description.IsNullOrEmpty())
                    {
                        strs.Add(";<!--" + ident.Description + "-->");
                    }

                    if (ident.IsList)
                    {
                        for (int i = 0; i < ident.Values.Count; i++)
                        {
                            strs.Add("Value" + i + "=" + ident.Values[i]);
                        }
                    }
                    else
                    {
                        strs.Add(ident.Key + "=" + ident.Value);
                    }
                }

                strs.Add("");
            }

            listidents.Clear();
            DirEx.CreateDir(Path.GetDirectoryName(filename));
            File.WriteAllLines(filename, strs.ToArray(), IniBase.IniEncoding);
        }
示例#60
0
 public override IAudioFilter Process(IAudioFilter input)
 {
     return(ConfigHelper.MakeXMLDuplicate(FilterProcess).ApplyTo(input));
 }