Example #1
0
 private static void InitConfig()
 {
     ConfigUtil config = new ConfigUtil("ConnectionString", "conn.ini");
     MSSqlHelper.host = config.Get("Host");
     MSSqlHelper.db = config.Get("DB");
     MSSqlHelper.user = config.Get("User");
     MSSqlHelper.pass = config.Get("Pass");
 }
Example #2
0
 private void BindCondition()
 {
     ConfigUtil config = new ConfigUtil("STORE", "config.ini");
     TBWarehouse.Text = config.Get("WAREHOUSE");
        // TBPosition.Text = config.Get("POSITION");
     ConditionService cs = new ConditionService();
     CBTrayStatus.ItemsSource = cs.GetEnumItemOptions<TrayStatus>(TrayStatus.Cancled);
     CBTrayStatus.SelectedIndex = 0;
 }
Example #3
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Hashtable ht = PrinterUtil.GetPrinterConfig();
     foreach (string printer in PrinterSettings.InstalledPrinters)
         CBPrinters.Items.Add(printer);
     CBPrinters.SelectedIndex = 0;
     for (int i = 0; i < CBPrinters.Items.Count; i++)
     {
         if (CBPrinters.Items[i].Equals(ht["PrinterName"].ToString()))
         {
             CBPrinters.SelectedIndex = i;
             break;
         }
     }
     this.TBSecond.Text = (int.Parse(ht["AutoClose"].ToString()) / 1000).ToString();
     this.TBCopy.Text = ht["Copy"].ToString();
     ConfigUtil config = new ConfigUtil("STORE", "config.ini");
     TBWarehouse.Text = config.Get("WAREHOUSE");
     TBPosition.Text = config.Get("POSITION");
     config = new ConfigUtil("DATEFORMAT", "config.ini");
     TBDateFormat.Text = config.Get("DATEFORMAT");
 }
Example #4
0
        private void BtnOk_Click(object sender, RoutedEventArgs e)
        {
            PrinterUtil.SetPrinterName(this.CBPrinters.SelectedItem.ToString());
            string sec = TBSecond.Text;
            int i = 3000;
            if (int.TryParse(sec, out i) && i > 0)
                PrinterUtil.SetPrinterAutoInterVal(i * 1000);
            int copy = 1;
            if(int.TryParse(TBCopy.Text,out copy)&& copy>0)
                PrinterUtil.SetPrintCopy(copy);
               // PrinterUtil.Save();

            ConfigUtil config = new ConfigUtil("STORE", "config.ini");

            config.Set("WAREHOUSE", TBWarehouse.Text);
            config.Set("POSITION", TBPosition.Text);
            config.Save();
            config = new ConfigUtil("DATEFORMAT", "config.ini");
            config.Set("DATEFORMAT", TBDateFormat.Text);
            config.Save();
            new InfoBoard(MsgLevel.Successful, "参数设置成功").ShowDialog();
            this.Close();
        }
Example #5
0
        protected override void OnClick()
        {
            ConfigUtil.type = "gas";

            GeoNetTools.CalculateFlowAccum(ConfigUtil.GetFlowAccumConfig(), ArcMap.Application);
        }
Example #6
0
        private void OnSketchFinished()
        {
            ConfigUtil.type = "water";
            IFeature pFeat = null;

            try
            {
                m_editor.StartOperation();

                pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate as IEditTemplate, m_editor, ArcMap.Application, false, false, true);



                GeometryTools.SplitLinesAtClick(ArcMap.Application, ConfigUtil.GetConfigValue("SplitLinesSuspendAA", "true"), ConfigUtil.GetConfigValue("SplitLinesAtLocation_Snap", 10.0), ConfigUtil.GetConfigValue("SplitLines_SkipDistance", .5), m_edSketch.Geometry as IPoint, false, true, false);



                pFeat.Store();
                m_editor.StopOperation(A4LGSharedFunctions.Localizer.GetString("AddPtsAndSplitLn"));
            }
            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + A4LGSharedFunctions.Localizer.GetString("AddPtsAndSplitLn") + "\n" + ex.Message);
                m_editor.AbortOperation();
            }
            finally
            {
                if (pFeat != null)
                {
                    (ArcMap.Application.Document as IMxDocument).ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, pFeat, null);
                }
                pFeat = null;
            }
        }
Example #7
0
        private void OnSketchFinished()
        {
            ConfigUtil.type = "water";
            //m_editor.UndoOperation();
            IFeature  pFeat = null;
            IEnvelope pEnv  = null;

            try
            {
                m_editor.StartOperation();
                Globals.ClearSelected(ArcMap.Application, false, new List <esriGeometryType>()
                {
                    esriGeometryType.esriGeometryPoint
                });

                pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);

                //CreatePoint(m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate);

                if (pFeat == null)
                {
                    return;
                }


                // addLat.AddLateralAtPoint(m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name);

                //((IFeatureSelection)m_editor.CurrentTemplate.Layer).Clear();
                m_editor.Map.SelectFeature(m_editor.CurrentTemplate.Layer as IFeatureLayer, pFeat);

                string resetFlow = AddLateralsFromPoint.AddLateralsFromMainPoint(ArcMap.Application, ConfigUtil.GetAddLateralsFromMainConfig(), pFeat, false, true, false);
                // m_editor.Map.SelectFeature(m_editor.CurrentTemplate.Layer as IFeatureLayer, pFeat);


                m_editor.Display.Invalidate((ArcMap.Document as IMxDocument).ActiveView.Extent, true, (short)esriScreenCache.esriAllScreenCaches);

                pFeat.Store();

                (ArcMap.Document as IMxDocument).ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, (ArcMap.Document as IMxDocument).ActiveView.Extent.Envelope);


                if (resetFlow.ToUpper() == "DIGITIZED")
                {
                    Globals.GetCommand("A4WaterUtilities_EstablishFlowDigitized", ArcMap.Application).Execute();
                }
                else if (resetFlow.ToUpper() == "ROLE")
                {
                    Globals.GetCommand("A4WaterUtilities_EstablishFlowAncillary", ArcMap.Application).Execute();
                }
                else if (resetFlow.ToUpper() == "Ancillary".ToUpper())
                {
                    Globals.GetCommand("A4WaterUtilities_EstablishFlowAncillary", ArcMap.Application).Execute();
                }
                else
                {
                }
                m_editor.StopOperation(A4LGSharedFunctions.Localizer.GetString("CrtAssetAndLat"));
            }
            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + A4LGSharedFunctions.Localizer.GetString("ALT_1") + ex.Message);
                m_editor.AbortOperation();
            }
            finally
            {
                pFeat = null;
                pEnv  = null;
            }
        }
 protected override void OnClick()
 {
     ConfigUtil.type = "address";
     AMGeometryTools.FlipLines(ArcMap.Application, ConfigUtil.GetAddressCenterlineConfig(), false);
 }
Example #9
0
        protected void PreInitializeForm()
        {
            TabIdentity   = 1;
            PrintDocument = new CustomPrintDocument();

            Size                      = new Size(ConfigUtil.GetIntParameter("WindowSizeX"), ConfigUtil.GetIntParameter("WindowSizeY"));
            WindowState               = (ConfigUtil.GetStringParameter("WindowState") == "Maximized" ? FormWindowState.Maximized : FormWindowState.Normal);
            PreviousWindowState       = WindowState;
            KeepInitialSpacesOnReturn = ConfigUtil.GetBoolParameter("KeepInitialSpacesOnReturn");
            KeepBulletListOnReturn    = ConfigUtil.GetBoolParameter("KeepBulletListOnReturn");
            WindowMode                = WindowModeEnum.Normal;
            //PreviousWindowState = (WindowState == FormWindowState.Minimized ? FormWindowState.Normal : WindowState);

            TextFont = ConfigUtil.GetFontParameter("FontInUse");
            String[] argbFontColor = ConfigUtil.GetStringParameter("FontInUseColorARGB").Split(new[] { ';' });
            TextFontColor = Color.FromArgb(Convert.ToInt32(argbFontColor[0]), Convert.ToInt32(argbFontColor[1]), Convert.ToInt32(argbFontColor[2]), Convert.ToInt32(argbFontColor[3]));
            String[] argbBackgroundColor = ConfigUtil.GetStringParameter("BackgroundColorARGB").Split(new[] { ';' });
            TextBackgroundColor = Color.FromArgb(Convert.ToInt32(argbBackgroundColor[0]), Convert.ToInt32(argbBackgroundColor[1]), Convert.ToInt32(argbBackgroundColor[2]), Convert.ToInt32(argbBackgroundColor[3]));
        }
 protected override void OnClick()
 {
     AMGeometryTools.FlipLines(ArcMap.Application, ConfigUtil.GetAddressCenterlineConfig(), true);
 }
Example #11
0
        public bool RestoreDatabase(string database, string filePath)
        {
            using (var sqlConnection = new SqlConnection(ConfigUtil.GetConnectionString()))
            {
                ServerConnection conn = new ServerConnection(ConfigUtil.GetServerName(), ConfigUtil.GetUserName(), ConfigUtil.GetPassword());
                srv = new Server(conn);

                try
                {
                    res = new Restore()
                    {
                        Database        = database,
                        NoRecovery      = false,
                        ReplaceDatabase = true
                    };


                    res.PercentComplete += new PercentCompleteEventHandler(Restore_PercentComplete);
                    res.Devices.AddDevice(filePath, DeviceType.File);

                    var DataFile = new RelocateFile();
                    var MDF      = res.ReadFileList(srv).Rows[0][1].ToString();
                    DataFile.LogicalFileName  = res.ReadFileList(srv).Rows[0][0].ToString();
                    DataFile.PhysicalFileName = srv.Databases[database].FileGroups[0].Files[0].FileName;

                    var LogFile = new RelocateFile();
                    var LDF     = res.ReadFileList(srv).Rows[1][1].ToString();
                    LogFile.LogicalFileName  = res.ReadFileList(srv).Rows[1][0].ToString();
                    LogFile.PhysicalFileName = srv.Databases[database].LogFiles[0].FileName;

                    res.RelocateFiles.Add(DataFile);
                    res.RelocateFiles.Add(LogFile);

                    this.KillProcesses(database);

                    //this.viewModel.RestoreStarted = true;

                    res.SqlRestore(srv);

                    return(true);
                }
                catch (SmoException ex)
                {
                    var innerExceptionMessage = "";
                    if (ex.InnerException != null)
                    {
                        innerExceptionMessage = ex.InnerException.Message;
                    }
                    MessageBox.Show(string.Format("{0}\n\n{1}", ex.Message, innerExceptionMessage));
                    return(false);
                }
                catch (IOException ex)
                {
                    MessageBox.Show(ex.Message);
                    return(false);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return(false);
                }
            }
        }
Example #12
0
 public void SetCertificate(
     string subjectName, StoreLocation storeLocation,
     StoreName storeName)
 {
     certificate = ConfigUtil.CreateCertificateFrom(storeLocation, storeName, X509FindType.FindBySubjectName, subjectName);
 }
Example #13
0
 public void SetCertificate(StoreLocation storeLocation,
                            StoreName storeName, X509FindType findType,
                            object findValue)
 {
     certificate = ConfigUtil.CreateCertificateFrom(storeLocation, storeName, findType, findValue);
 }
Example #14
0
 private void BtnNew_Click(object sender, RoutedEventArgs e)
 {
     ConfigUtil config = new ConfigUtil("STORE", "config.ini");
     ProcessMsg msg = conditionService.GenPosition(config.Get("POSITION"));
     if (msg.result)
     {
         SPDataSource = null;
         DGTrayItemsDetail.ItemsSource = null;
         BtnFinsh.IsEnabled = false;
         BtnRePrint.IsEnabled = false;
         TBPackageId.IsEnabled = true;
         LabPackNum.Content = "0";
         TBTrayId.Text = "";
         TBPackageId.Text = "";
       //  LoadWarehouseConfig();
         TBWarehouse.Text = config.Get("WAREHOUSE");
         TBPosition.Text = msg.GetAllLevelMsgs().Trim();
     }
     else {
         new InfoBoard(MsgLevel.Mistake, msg.GetAllLevelMsgs()).ShowDialog();
     }
 }
Example #15
0
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            ConfigUtil.type = "gas";

            A4WaterUtilities.GeoNetTools.AddBarrier(ArcMap.Document.CurrentLocation, ArcMap.Application, ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0), true);



            base.OnMouseDown(arg);
        }
Example #16
0
        public static ConfigAtmosphereSeries LoadFromFileAndDetach(string path)
        {
            ConfigAtmosphereSeries series = UnityEngine.Object.Instantiate <ConfigAtmosphereSeries>(ConfigUtil.LoadConfig <ConfigAtmosphereSeries>(path));

            series.InitAfterLoad();
            series._path = path;
            return(series);
        }
Example #17
0
 protected override void OnClick()
 {
     ConfigUtil.type = "gas";
     GeoNetTools.CheckConnections(ArcMap.Application, ConfigUtil.GetConfigValue("ConnectionChecker_CheckOnlyVisibleLayers", false));
 }
Example #18
0
 public RecyclerAdapter(Context con, Config c)
 {
     this.Context = con;
     this.Config  = c;
     this.Items   = ConfigUtil.ConvertToDisplay(this.Config);
 }
 protected override void OnClick()
 {
     AMGeometryTools.CreateIntersectionPoints(ArcMap.Application, ConfigUtil.GetAddressCenterlineConfig(), false);
 }
        private static string GetAppSetting(string key, string defaultValue)
        {
            var value = ConfigUtil.GetAppConfig(key);

            return(!string.IsNullOrWhiteSpace(value) ? value : defaultValue);
        }
        private void OnSketchFinished()
        {
            IFeature pFeat;

            try
            {
                m_editor.StartOperation();

                pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate as IEditTemplate, m_editor, ArcMap.Application, false, false, true);



                GeometryTools.SplitLinesAtClick(ArcMap.Application, ConfigUtil.GetConfigValue("SplitLinesSuspendAA", "true"), ConfigUtil.GetConfigValue("SplitLinesAtLocation_Snap", 10.0), ConfigUtil.GetConfigValue("SplitLines_SkipDistance", .5), m_edSketch.Geometry as IPoint, false, true, false);



                pFeat.Store();
                m_editor.StopOperation(A4LGSharedFunctions.Localizer.GetString("AddPtsAndSplitLn"));
            }
            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + A4LGSharedFunctions.Localizer.GetString("AddPtsAndSplitLn") + "\n" + ex.Message);
                m_editor.AbortOperation();
            }
            finally
            {
                pFeat = null;
            }
        }
Example #22
0
        public String GetNavHtml()
        {
            string key     = "NavHTML";
            string navHTML = (string)primitivesCache.GetData(key);

            if (navHTML == null)
            {
                SystemDA da = new SystemDA();
                navHTML = da.GetNavHtml();

                primitivesCache.Add(key, navHTML, CacheItemPriority.Normal, null,
                                    new SlidingTime(TimeSpan.FromMinutes(System.Convert.ToInt32(ConfigUtil.GetConfigItem("LongCacheDuration")))));
            }
            return(navHTML);
        }
Example #23
0
        protected override void Initialize()
        {
            base.Initialize();
            try
            {
                configObj = ConfigUtil.ReadConfig(CONFIGFILE_NAME, typeof(HKWarrantAndCBBCFilesDownloadConfig)) as HKWarrantAndCBBCFilesDownloadConfig;
            }
            catch (System.Exception ex)
            {
                Logger.Log("Error happens when initializing task... Ex: " + ex.Message);
            }

            //logger = new Logger(configObj.LOG_FILE_PATH, Logger.LogMode.New);
            holidayList = ConfigUtil.ReadConfig(HOLIDAY_INFO_FILE_PATH, typeof(List <DateTime>)) as List <DateTime>;
            if (!string.IsNullOrEmpty(configObj.END_DATE))
            {
                try
                {
                    DateTime dt      = Convert.ToDateTime(configObj.END_DATE.Trim().ToString());
                    double   seconds = dt.Subtract(endDate).TotalSeconds;
                    if (seconds > 0)
                    {
                        Logger.Log("EndDate is over Today,Defult is Now!");
                        throw new System.Exception("ENDDATE Setting is error!");
                    }
                    else
                    {
                        endDate = DateTime.ParseExact(configObj.END_DATE, "yyyy-MM-dd", new CultureInfo("en-US"));
                    }
                }
                catch (System.FormatException fEx)
                {
                    Logger.Log("ENDDATE format is error!" + fEx.Message);
                }
                catch (System.Exception ex)
                {
                    Logger.Log(ex.Message);
                }
            }
            if (!string.IsNullOrEmpty(configObj.START_DATE))
            {
                startDate = DateTime.ParseExact(configObj.START_DATE, "yyyy-MM-dd", new CultureInfo("en-US"));
            }
            else
            {
                startDate = MiscUtil.GetLastTradingDay(endDate, holidayList, 1);
            }

            if (string.IsNullOrEmpty(configObj.CBBC_DOWNLOAD_FOLDER))
            {
                configObj.CBBC_DOWNLOAD_FOLDER = @"D:\";
            }
            if (string.IsNullOrEmpty(configObj.WARRANT_DOWNLOAD_FOLDER))
            {
                configObj.WARRANT_DOWNLOAD_FOLDER = @"D:\";
            }
            if (string.IsNullOrEmpty(configObj.GENERATE_DOWNLOAD_REPORTS_LIST_PATH))
            {
                configObj.GENERATE_DOWNLOAD_REPORTS_LIST_PATH = @"D:\";
            }
            #region
            //if (string.IsNullOrEmpty(configObj.START_DATE))
            //{
            //    string[] date = DateTime.Now.AddDays(-1).ToString().Split(' ')[0].Split('-');
            //    startDate.Year = date[0];
            //    startDate.Month = date[1];
            //    startDate.Day = date[2];
            //}
            //else
            //{
            //    string[] temp = configObj.START_DATE.Split('_');
            //    startDate.Year = temp[0].ToString();
            //    startDate.Month = temp[1].ToString();
            //    startDate.Day = temp[2].ToString();
            //}
            //if (string.IsNullOrEmpty(configObj.END_DATE))
            //{
            //    startDate.Year = DateTime.Now.Year.ToString();
            //    startDate.Month = DateTime.Now.Month.ToString();
            //    startDate.Day = DateTime.Now.Day.ToString();
            //}
            //else
            //{
            //    string[] temp = configObj.END_DATE.Split('_');
            //    endDate.Year = temp[0].ToString();
            //    endDate.Month = temp[1].ToString();
            //    endDate.Day = temp[2].ToString();
            //}
            #endregion
        }
Example #24
0
    protected void SetGridColumns()
    {
        bool needToRefreshColumns = true;

        if (lstColumns.Items.Count != 0)
        {
            needToRefreshColumns   = false;
            Session["SEARCH_COLS"] = lstColumns;
        }


        //when selected column names count = 0
        if (needToRefreshColumns)
        {
            //get Default selected columns from web.config in appSettings
            string l_defaultColumnsFromConfig = ConfigUtil.GetConfigItem("ProfileSearchDefaultColumns");


            ListBox lstcolumns = null;
            if (Session["SEARCH_COLS"] != null)
            {
                lstcolumns = (ListBox)Session["SEARCH_COLS"];
                foreach (ListItem item in lstcolumns.Items)
                {
                    if (item.Selected)
                    {
                        if (!l_defaultColumnsFromConfig.Contains(item.Text))
                        {
                            l_defaultColumnsFromConfig = l_defaultColumnsFromConfig + "," + item.Text;
                        }
                    }
                }
            }



            string[] l_defaultColumnsArr = l_defaultColumnsFromConfig.Split(',');

            List <string> l_AllColumns = new List <string>();
            foreach (DataControlField l_GridColumn in grdSearchResults.Columns)
            {
                //using filtering only for not-Templated columns
                if (!string.IsNullOrEmpty(l_GridColumn.SortExpression))
                {
                    l_AllColumns.Add(l_GridColumn.HeaderText);
                }
            }

            //l_AllColumns.Remove("Division");

            //bind listBox

            lstColumns.Items.Clear();
            lstColumns.DataSource = l_AllColumns;
            lstColumns.DataBind();


            //check "default" listBoxItems
            foreach (ListItem l_Item in lstColumns.Items)
            {
                foreach (string columnName in l_defaultColumnsArr)
                {
                    //after split operation <string.split(',')> the last element usually is space
                    //so we must validate each value
                    if (!string.IsNullOrEmpty(columnName))
                    {
                        if (columnName == l_Item.Value)
                        {
                            l_Item.Selected = true;
                        }
                    }
                }

                if (l_Item.Value == "Name")
                {
                    l_Item.Enabled = false;
                }
            }
        }

        for (int i = 1; i < grdSearchResults.Columns.Count; i++)
        {
            DataControlField l_Field = grdSearchResults.Columns[i];

            //when current DataControlField is aspTemplateField(Edit or Delete) then break
            if (string.IsNullOrEmpty(l_Field.SortExpression))
            {
                break;
            }

            bool l_isVisibleColumn = false;

            foreach (ListItem l_ListItem in lstColumns.Items)
            {
                if (l_ListItem.Selected)
                {
                    if (l_ListItem.Value == l_Field.HeaderText)
                    {
                        l_isVisibleColumn = true;
                        break;
                    }
                }
            }

            l_Field.Visible = l_isVisibleColumn;
        }

        // Hide the Why column if we're not dealing with a keyword search
        if (Session["ProfileSearchRequestKeywordList"] != null)
        {
            if (((List <String>)Session["ProfileSearchRequestKeywordList"]).Count > 0)
            {
                grdSearchResults.Columns[grdSearchResults.Columns.Count - 2].Visible = true;
            }
            else
            {
                grdSearchResults.Columns[grdSearchResults.Columns.Count - 2].Visible = false;
            }
        }
    }
Example #25
0
        private async Task <int> CheckAndAddOrderProfit(OrderInfo orderInfo, IDbConnection conn, IDbTransaction transaction = null)
        {
            var profit = new Profit();

            if (orderInfo.State == OrderState.已结算 && (!orderInfo.ProfitId.HasValue || orderInfo.ProfitId == 0))
            {
                var user = await _userService.QueryByUserIdAsync((int)orderInfo.UserId);

                profit.CreateTime = DateTime.Now;
                profit.Status     = ProfitStatus.Active;
                profit.Type       = ProfitType.OrderBack;
                profit.UserId     = orderInfo.UserId;
                profit.FromOrder  = orderInfo.Code;
                profit.FromUser   = orderInfo.UserId;
                profit.Remark     = $"来自订单[{orderInfo.ItemName}]";
                profit.Amount     = user.Type == UserType.Commom ? orderInfo.BackPrice * ConfigUtil.GetConfig <DataApiAppSettings>("AppSettings").OrderBackRate : orderInfo.BackPrice * (ConfigUtil.GetConfig <DataApiAppSettings>("AppSettings").OrderBackRate + 0.1);
                profit.ProfitId   = await conn.InsertAsync <Profit>(profit, transaction);

                //增加合伙人收益
                var profitUserId = await GetProfitUser((int)orderInfo.UserId, conn, transaction);

                if (profitUserId != 0)
                {
                    var pProfit = new Profit();
                    pProfit.CreateTime = DateTime.Now;
                    pProfit.Status     = ProfitStatus.Active;
                    pProfit.Type       = ProfitType.ChildBack;
                    pProfit.UserId     = profitUserId;
                    pProfit.FromOrder  = orderInfo.Code;
                    profit.Remark      = $"来自用户[{profitUserId}]的订单[{orderInfo.ItemName}]";
                    pProfit.FromUser   = orderInfo.UserId;
                    pProfit.Amount     = orderInfo.BackPrice * ConfigUtil.GetConfig <DataApiAppSettings>("AppSettings").OrderBackRate *ConfigUtil.GetConfig <DataApiAppSettings>("AppSettings").OrderProfitUserBackRate;
                    await conn.InsertAsync <Profit>(pProfit, transaction);
                }
                //如果有分享,更新分享收益状态为有效
                var profitFromShared = await conn.ExecuteAsync(Procedure.UpdateProfitFromSharedByOrderId, new { code = orderInfo.Code }, transaction, null, CommandType.StoredProcedure);
            }
            return(profit.ProfitId == 0 ? orderInfo.ProfitId ?? 0 : profit.ProfitId);
        }
Example #26
0
        private void LoadDataSources(XmlElement root)
        {
            var         list         = root.GetElementsByTagName("dataSource");
            XmlElement  element      = null;
            XmlElement  locElement   = null;
            XmlNodeList locationList = null;

            for (int i = 0, n = list.Count; i < n; i++)
            {
                element = (XmlElement)list.Item(i);
                var dscList      = new List <DataSourceConfig>();
                var dsNamePrefix = element.GetAttribute("name");
                try
                {
                    var dsType = element.GetAttribute("type");
                    locElement = FindPropertyByName(element, "location");
                    if (locElement == null)
                    {
                        throw new ArgumentNullException("dataSource xml XmlElement with name of " + dsNamePrefix
                                                        + " has no location Element");
                    }

                    locationList = locElement.GetElementsByTagName("location");
                    var dsIndex = 0;
                    for (int j = 0, m = locationList.Count; j < m; ++j)
                    {
                        var locStr     = ((XmlElement)locationList.Item(j)).InnerText;
                        var colonIndex = locStr.IndexOf(':');
                        var slashIndex = locStr.IndexOf('/');
                        var dsHost     = Runtime.Substring(locStr, 0, colonIndex).Trim();
                        var dsPort     = Convert.ToInt32(Runtime.Substring(locStr, colonIndex + 1, slashIndex).Trim());
                        var schemas    = SplitUtil.Split(Runtime.Substring(locStr, slashIndex + 1).Trim(), ',', '$', '-');
                        foreach (var dsSchema in schemas)
                        {
                            var dsConf = new DataSourceConfig();
                            ParameterMapping.Mapping(dsConf, ConfigUtil.LoadElements(element));
                            dscList.Add(dsConf);

                            switch (dsIndex)
                            {
                            case 0:
                            {
                                dsConf.Name = dsNamePrefix;
                                break;
                            }

                            case 1:
                            {
                                dscList[0].Name = dsNamePrefix + "[0]";
                                goto default;
                            }

                            default:
                            {
                                dsConf.Name = dsNamePrefix + "[" + dsIndex + "]";
                                break;
                            }
                            }
                            dsConf.Type     = dsType;
                            dsConf.Database = dsSchema;
                            dsConf.Host     = dsHost;
                            dsConf.Port     = dsPort;
                            ++dsIndex;
                        }
                    }
                }
                catch (Exception e)
                {
                    throw new ConfigException("dataSource " + dsNamePrefix + " define error", e);
                }

                foreach (var dsConf_1 in dscList)
                {
                    if (dataSources.ContainsKey(dsConf_1.Name))
                    {
                        throw new ConfigException("dataSource name " + dsConf_1.Name + "duplicated!");
                    }

                    dataSources[dsConf_1.Name] = dsConf_1;
                }
            }
        }
Example #27
0
        private void OnSketchFinished()
        {
            ConfigUtil.type = "water";
            IFeature           pFeat       = null;
            ISegmentCollection pSegColl    = null;
            IEnumSegment       pESeg       = null;
            ISegment           testSegment = null;
            ISegmentCollection segColTest  = null;
            object             Missing     = null;

            try
            {
                // Send a shift-tab to hide the construction toolbar

                try
                {
                    m_editor.StartOperation();
                }
                catch
                {
                    m_editor.AbortOperation();
                    m_editor.StartOperation();
                }
                bool twoPoint = false;
                (ArcMap.Application.Document as IMxDocument).FocusMap.ClearSelection();
                List <IFeature> pLstFeat = null;
                if (Control.ModifierKeys == Keys.Control)
                {
                    twoPoint = CreateLineWithEndPoints.CreatePoints(ArcMap.Application, ConfigUtil.GetLinePointAtEndsConfig(), m_edSketch.Geometry as IPolyline, (IFeatureLayer)m_editor.CurrentTemplate.Layer, false, out pLstFeat);
                }
                else
                {
                    twoPoint = CreateLineWithEndPoints.CreatePoints(ArcMap.Application, ConfigUtil.GetLinePointAtEndsConfig(), m_edSketch.Geometry as IPolyline, (IFeatureLayer)m_editor.CurrentTemplate.Layer, true, out pLstFeat);
                }


                if (twoPoint)
                {
                    pSegColl = (ISegmentCollection)m_edSketch.Geometry;
                    pESeg    = pSegColl.EnumSegments;
                    pESeg.Reset();


                    int partIndex    = 0;
                    int segmentIndex = 0;

                    pESeg.Next(out testSegment, ref partIndex, ref segmentIndex);

                    while (testSegment != null)
                    {
                        segColTest = new PolylineClass();

                        Missing = Type.Missing;
                        segColTest.AddSegment(testSegment, ref Missing, ref Missing);

                        pFeat = Globals.CreateFeature(segColTest as IGeometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);
                        pFeat.Store();
                        pESeg.Next(out testSegment, ref partIndex, ref segmentIndex);
                    }
                }
                else
                {
                    pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);
                    pFeat.Store();
                }

                foreach (IFeature pFt in pLstFeat)
                {
                    pFt.Store();
                }
                pLstFeat = null;

                m_editor.StopOperation(A4LGSharedFunctions.Localizer.GetString("CrtLnWithPts"));
                (ArcMap.Application.Document as IMxDocument).ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);
            }
            catch { }
            finally
            {
                pFeat       = null;
                pSegColl    = null;
                pESeg       = null;
                testSegment = null;
                segColTest  = null;
                Missing     = null;
            }
        }
Example #28
0
        private void LoadDataNodes(XmlElement root)
        {
            var         list           = root.GetElementsByTagName("dataNode");
            XmlElement  element        = null;
            XmlElement  dsElement      = null;
            XmlNodeList dataSourceList = null;

            for (int i = 0, n = list.Count; i < n; i++)
            {
                element = (XmlElement)list.Item(i);
                var dnNamePrefix = element.GetAttribute("name");
                IList <DataNodeConfig> confList = new List <DataNodeConfig>();
                try
                {
                    dsElement = FindPropertyByName(element, "dataSource");
                    if (dsElement == null)
                    {
                        throw new ArgumentNullException("dataNode xml XmlElement with name of " + dnNamePrefix
                                                        + " has no dataSource Element");
                    }

                    dataSourceList = dsElement.GetElementsByTagName("dataSourceRef");
                    var dataSources = new string[dataSourceList.Count][];
                    for (int j = 0, m = dataSourceList.Count; j < m; ++j)
                    {
                        var @ref     = (XmlElement)dataSourceList.Item(j);
                        var dsString = @ref.InnerText;
                        dataSources[j] = SplitUtil.Split(dsString, ',', '$', '-', '[', ']');
                    }

                    if (dataSources.Length <= 0)
                    {
                        throw new ConfigException("no dataSourceRef defined!");
                    }
                    foreach (var dss in dataSources)
                    {
                        if (dss.Length != dataSources[0].Length)
                        {
                            throw new ConfigException("dataSource number not equals!");
                        }
                    }

                    for (int k = 0, limit = dataSources[0].Length; k < limit; ++k)
                    {
                        var dsString = new StringBuilder();
                        for (var dsIndex = 0; dsIndex < dataSources.Length; ++dsIndex)
                        {
                            if (dsIndex > 0)
                            {
                                dsString.Append(',');
                            }
                            dsString.Append(dataSources[dsIndex][k]);
                        }

                        var conf = new DataNodeConfig();
                        ParameterMapping.Mapping(conf, ConfigUtil.LoadElements(element));
                        confList.Add(conf);

                        switch (k)
                        {
                        case 0:
                        {
                            conf.Name = limit == 1 ? dnNamePrefix : dnNamePrefix + "[" + k + "]";
                            break;
                        }

                        default:
                        {
                            conf.Name = dnNamePrefix + "[" + k + "]";
                            break;
                        }
                        }
                        conf.DataSource = dsString.ToString();
                    }
                }
                catch (Exception e)
                {
                    throw new ConfigException("dataNode " + dnNamePrefix + " define error", e);
                }

                foreach (var conf_1 in confList)
                {
                    if (dataNodes.ContainsKey(conf_1.Name))
                    {
                        throw new ConfigException("dataNode " + conf_1.Name + " duplicated!");
                    }
                    dataNodes[conf_1.Name] = conf_1;
                }
            }
        }
Example #29
0
        private void OnSketchFinished()
        {
            ConfigUtil.type = "water";
            Keys ModKey = Control.ModifierKeys;

            // Send a shift-tab to hide the construction toolbar

            m_editor.StartOperation();
            IFeature        pFeat   = null;
            returnFeatArray pRetVal = null;

            if (ModKey == Keys.Shift)
            {
                pFeat   = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);
                pRetVal = ConnectClosest.ConnectClosestFeatureAtPoint(ArcMap.Application, ConfigUtil.GetConnectClosestConfig(), m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name, true, ModKey);
                //   pFeat.Store();
            }
            else if (ModKey == (Keys.Control | Keys.Shift))
            {
                pFeat   = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);
                pRetVal = ConnectClosest.ConnectClosestFeatureAtPoint(ArcMap.Application, ConfigUtil.GetConnectClosestConfig(), m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name, true, ModKey);
                // pFeat.Store();
            }
            else if (ModKey == Keys.Control)
            {
                pFeat   = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, true, true);
                pRetVal = ConnectClosest.ConnectClosestFeatureAtPoint(ArcMap.Application, ConfigUtil.GetConnectClosestConfig(), m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name, true, ModKey);
                //    pFeat.Store();
            }
            else
            {
                pFeat   = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, true, true);
                pRetVal = ConnectClosest.ConnectClosestFeatureAtPoint(ArcMap.Application, ConfigUtil.GetConnectClosestConfig(), m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name, true, ModKey);
            }
            pFeat.Store();
            foreach (IFeature featus in pRetVal.Features)
            {
                featus.Store();
            }

            if (pRetVal.Options == "DIGITIZED")
            {
                Globals.GetCommand("A4WaterUtilities_EstablishFlowDigitized", ArcMap.Application).Execute();
            }
            else if (pRetVal.Options == "ROLE")
            {
                Globals.GetCommand("A4WaterUtilities_EstablishFlowAncillary", ArcMap.Application).Execute();
            }
            else if (pRetVal.Options == "Ancillary".ToUpper())
            {
                Globals.GetCommand("A4WaterUtilities_EstablishFlowAncillary", ArcMap.Application).Execute();
            }
            else
            {
            }
            //            addLat.AddLateralAtPoint(m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name);

            m_editor.StopOperation(A4LGSharedFunctions.Localizer.GetString("CrtAssetAndLat"));

            //IEnvelope pEnv = pFeat.Shape.Envelope;
            //pEnv.Expand(8, 8, true);

            (ArcMap.Application.Document as IMxDocument).ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, pFeat, null);
            //pEnv = null;
            pFeat   = null;
            pRetVal = null;
        }
Example #30
0
 public void Awake()
 {
     Instance = this;
 }
Example #31
0
 protected override void OnMouseDown(MouseEventArgs arg)
 {
     ConfigUtil.type = "gas";
     GeoNetTools.CalculateFlowAccumAtLocation(ConfigUtil.GetFlowAccumConfig(), ArcMap.Application, Convert.ToDouble(ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0)));
 }
Example #32
0
 public void InitHomeTestCases()
 {
     home = new LoginPage(GetDriver()).Login(ConfigUtil.GetString("user.username"), ConfigUtil.GetString("user.password"));
 }
Example #33
0
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            ConfigUtil.type = "gas";
            // IPoint point = ArcMap.Document.CurrentLocation;//ArcMap.Document.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
            GeoNetTools.RemoveFlagBarrier(ArcMap.Document.CurrentLocation, ArcMap.Application, ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0));

            base.OnMouseDown(arg);
        }
        private void OnSketchFinished()
        {
            IFeature pFeat;

            try
            {
                m_editor.StartOperation();

                pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate as IEditTemplate, m_editor, ArcMap.Application, false, false, true);



                GeometryTools.SplitLinesAtClick(ArcMap.Application, ConfigUtil.GetConfigValue("SplitLinesSuspendAA", "true"), ConfigUtil.GetConfigValue("SplitLinesAtLocation_Snap", 10.0), ConfigUtil.GetConfigValue("SplitLines_SkipDistance", .5), m_edSketch.Geometry as IPoint, false, true, false);



                pFeat.Store();
                m_editor.StopOperation("Add Point and split line");
                (ArcMap.Application.Document as IMxDocument).ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, pFeat, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in the Add Point and Split\n" + ex.Message);
                m_editor.AbortOperation();
            }
            finally
            {
                pFeat = null;
            }
        }
Example #35
0
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            ConfigUtil.type = "gas";
            string selectFeatures = ConfigUtil.GetConfigValue("Trace_Return_Selection", "false");
            bool   selectEdges;

            if (selectFeatures.ToUpper() == "true".ToUpper() && Control.ModifierKeys == Keys.Control)
            {
                selectEdges = false;
            }
            else if (selectFeatures.ToUpper() == "true".ToUpper())
            {
                selectEdges = true;
            }
            else if (selectFeatures.ToUpper() == "false".ToUpper() && Control.ModifierKeys == Keys.Control)
            {
                selectEdges = true;
            }
            else
            {
                selectEdges = false;
            }

            bool   traceIndeterminate          = ConfigUtil.GetConfigValue("TraceFlow_Interminate", false);
            string ISOsourceFeatureLayerName   = ConfigUtil.GetConfigValue("TraceIsolation_Source_FeatureLayer", "");
            string ISOvalveFeatureLayerName    = ConfigUtil.GetConfigValue("TraceIsolation_Valve_FeatureLayer", "");
            string ISOoperableFieldNameValves  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Valves", "");
            string ISOoperableFieldNameSources = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Sources", "");

            string[] ISOoperableValues  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Values", "").Split('|');
            string   ISOvalveAddSQL     = ConfigUtil.GetConfigValue("TraceIsolation_Valve_AddSQL", "");
            double   SnapTol            = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            string   ClearFlagBeforeIso = ConfigUtil.GetConfigValue("TraceIsolation_ClearFlagsOnClick", "true");
            string   closedValveQuery   = ConfigUtil.GetConfigValue("TraceIsolation_Valve_ClosedValveQuery", "");

            Globals.RemoveTraceGraphics(((IMxDocument)ArcMap.Application.Document).FocusMap, false);

            Globals.ClearSelected(ArcMap.Application, false);


            if (ClearFlagBeforeIso.ToUpper() == "TRUE")
            {
                Globals.ClearGNFlags(ArcMap.Application, Globals.GNTypes.Flags);
            }
            IPolyline  mergedLines = new PolylineClass();
            List <int> procoids    = new List <int>();


            IPoint point            = ArcMap.Document.CurrentLocation;
            bool   addFlagBarScreen = ConfigUtil.GetConfigValue("TraceIsolation_AddResultsAsLayers", "false") == "false" ? false : true;

            string returnVal = GeoNetTools.TraceIsolation(new double[] { point.X }, new double[] { point.Y }, ArcMap.Application, ISOsourceFeatureLayerName, ISOvalveFeatureLayerName, ISOoperableFieldNameValves, ISOoperableFieldNameSources,
                                                          SnapTol, true, ISOoperableValues, ISOvalveAddSQL, traceIndeterminate, true, selectEdges, "", "", "", closedValveQuery, null, out mergedLines, out procoids, addFlagBarScreen);

            if (returnVal != null)
            {
                string[] retVals = returnVal.Split('_');

                switch (retVals.Length)
                {
                case 1:
                    break;

                case 2:
                    MessageBox.Show(retVals[1]);
                    break;

                case 3:
                    break;

                default:
                    break;
                }
            }

            point = null;
        }
Example #36
0
        private void BtnExport_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "CSV �ļ���ʽ|*.csv";
            sfd.Title = "����CSV�ļ�";

            sfd.FileName="CSVData"+DateTime.Now.ToString("yyyyMMddHHmmss")+".csv";
            sfd.ShowDialog();
            if (sfd.FileName != "")
            {
                if (DGTrayItemsDetail.Items.Count > 0)
                {
                    List<string> exportIds = new List<string>();
                    foreach (Trays t in DGTrayItemsDetail.Items)
                    {
                        exportIds.Add(t.trayId);
                    }
                    ConfigUtil config = new ConfigUtil("CSVFILEDS", "csv.ini");
                    List<string> csvFields=new List<string> ();
                   string[] keys =config.GetAllNodeKey();
                   foreach (string key in keys)
                   {
                       if (config.Get(key) == "1")
                           csvFields.Add(key);
                   }
                    ProcessMsg msg = exportService.ExportTraySumPartCSV(exportIds,sfd.FileName,csvFields);
                    new InfoBoard(MsgLevel.Info, msg.GetAllLevelMsgs()).ShowDialog();
                    config = new ConfigUtil("AUTO", "config.ini");

                    if (msg.result && bool.Parse(config.Get("EXPORTLOAD")))
                        BtnSearch_Click(sender, e);
                }
            }
        }