示例#1
0
 private void Start()
 {
     try
     {
         if (string.IsNullOrEmpty(WebConfig.LpFileName))
         {
             //string lpFileName = HttpContext.Current.Request.PhysicalApplicationPath + "web.ini";
             string lpFileName = AppDomain.CurrentDomain.BaseDirectory + "web.ini";
             string project    = IniHepler.GetConfig(lpFileName, "Automatic", "Project");
             WebConfig.Ledger     = CommFunc.ConvertDBNullToInt32(IniHepler.GetConfig(lpFileName, "Automatic", "Ledger"));
             WebConfig.Port       = CommFunc.ConvertDBNullToInt32(IniHepler.GetConfig(lpFileName, "Automatic", "Port"));
             WebConfig.MemcachKey = project + "->" + WebConfig.Ledger + "->";
             string connect = ConfigHelper.GetConnectionStrings("DefaultConnection");
             string dbHost  = IniHepler.GetConfig(lpFileName, "Db", "DbHost");
             string dbName  = IniHepler.GetConfig(lpFileName, "Db", "DbName");
             string dbUid   = IniHepler.GetConfig(lpFileName, "Db", "DbUid");
             string dbPwd   = IniHepler.GetConfig(lpFileName, "Db", "DBPwd");
             dbPwd = ConfigHelper.Decrypt(dbPwd);
             //
             connect = string.Format(connect, dbHost, dbName, dbUid, dbPwd);
             YDS6000.BLL.WholeBLL.ConnectionString(connect);
             WebConfig.LpFileName = lpFileName;
             Automatic.Start();
             FileLog.WriteLog("启动成功:" + project);
         }
     }
     catch (Exception ex)
     {
         FileLog.WriteLog("启动错误:" + ex.Message + ex.StackTrace);
     }
 }
示例#2
0
        /// <summary>
        /// 发送采集数据
        /// </summary>
        /// <param name="var"></param>
        /// <returns></returns>
        public static bool SendCollectVal(List <ApiVar> var)
        {
            Automatic.Start();
            string val = JsonHelper.Serialize(var);
            bool   rst = YDS6000.Models.ProcessSevice.Client(WebConfig.Port).SendCollectVal(val);

            return(rst);
        }