Ejemplo n.º 1
0
        //T_46_004
        public static void GetAllKPIFormulaColumn(DataBaseConfig ADataBaseConfig, GlobalSetting AGolbalSetting, ref List <KPIFormulaColumn> AListKPIFormulaColumn)
        {
            AListKPIFormulaColumn.Clear();
            DataTable LDataTableReturn = new DataTable();
            string    LStrDynamicSQL   = string.Empty;
            string    LStrRentToken    = string.Empty;
            string    LStrSingleObject = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperationReturn = new DatabaseOperation01Return();
                DataOperations01          LDataOperations          = new DataOperations01();

                LStrDynamicSQL = string.Format("SELECT * FROM T_46_004_{0} "
                                               , AGolbalSetting.StrRent);
                LDatabaseOperationReturn = LDataOperations.SelectDataByDynamicSQL(ADataBaseConfig.IntDatabaseType, ADataBaseConfig.StrDatabaseProfile, LStrDynamicSQL);
                if (!LDatabaseOperationReturn.BoolReturn)
                {
                    LDataTableReturn = null;
                }
                else
                {
                    LDataTableReturn = LDatabaseOperationReturn.DataSetReturn.Tables[0];
                    foreach (DataRow dr in LDataTableReturn.Rows)
                    {
                        KPIFormulaColumn kpiformulatemp = new KPIFormulaColumn();
                        kpiformulatemp.FormulaCharID           = LongParse(dr["C001"].ToString(), 0);
                        kpiformulatemp.ColumnName              = dr["C002"].ToString();
                        kpiformulatemp.ColumnSource            = IntParse(dr["C004"].ToString(), 0);
                        kpiformulatemp.ApplayName              = dr["C005"].ToString();
                        kpiformulatemp.DataType                = IntParse(dr["C006"].ToString(), 0);
                        kpiformulatemp.ApplyCycle              = dr["C007"].ToString();
                        kpiformulatemp.SpecialObjectTypeNumber = IntParse(dr["C008"].ToString(), 0);
                        AListKPIFormulaColumn.Add(kpiformulatemp);
                    }
                }
            }
            catch (Exception ex)
            {
                LDataTableReturn = null;
                FileLog.WriteInfo("GetAllKPIFormulaColumn()", ex.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Thêm menu 'Open with ImageGlass' vào menu ngữ cảnh
        /// </summary>
        /// <param name="igPath">Đường dẫn của tập tin ImageGlass.exe</param>
        /// <param name="extensions">Thành phần mở rộng, ví dụ: .png;.jpg</param>
        public static void AddImageGlassToContextMenu(string igPath, string extensions)
        {
            try
            {
                string[] exts = extensions.Replace("*", "").Split(new char[] { ';' },
                                                                  StringSplitOptions.RemoveEmptyEntries);

                foreach (string ext in exts)
                {
                    AddContextMenuItem(ext, "Open with ImageGlass", "", igPath + " %1", igPath, "0");
                }

                GlobalSetting.SetConfig("ContextMenuExtensions", extensions);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
        public static String GetStringValue(string Key)
        {
            using (var db = new EBBPEntities())
            {
                GlobalSetting setting = db.GlobalSettings.Where(x => x.Name.ToUpper() == Key.ToUpper()).FirstOrDefault();

                if (null == setting)
                {
                    throw new Exception("Setting not found!");
                }

                if ("String" != setting.Type)
                {
                    throw new Exception("Data type mismatch!");
                }

                return(setting.Value);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Update base of GlobalSetting Object.
        /// Data manipulation processing for: new, deleted, updated GlobalSetting
        /// </summary>
        /// <param name="globalSettingObject"></param>
        /// <returns></returns>
        public bool UpdateBase(GlobalSetting globalSettingObject)
        {
            // use of switch for different types of DML
            switch (globalSettingObject.RowState)
            {
            // insert new rows
            case BaseBusinessEntity.RowStateEnum.NewRow:
                return(Insert(globalSettingObject));

            // delete rows
            case BaseBusinessEntity.RowStateEnum.DeletedRow:
                return(Delete(globalSettingObject.Id));
            }
            // update rows
            using (GlobalSettingDataAccess data = new GlobalSettingDataAccess(ClientContext))
            {
                return(data.Update(globalSettingObject) > 0);
            }
        }
Ejemplo n.º 5
0
        private void frmSetting_FormClosing(object sender, FormClosingEventArgs e)
        {
            //Save config---------------------------------
            if (this.WindowState == FormWindowState.Normal)
            {
                //Windows Bound-------------------------------------------------------------------
                GlobalSetting.SetConfig(this.Name + ".WindowsBound", GlobalSetting.RectToString(this.Bounds));
            }

            //Windows State-------------------------------------------------------------------
            GlobalSetting.SetConfig(this.Name + ".WindowsState", this.WindowState.ToString());

            //Save extra supported extensions
            GlobalSetting.SupportedExtraExtensions = txtSupportedExtensionExtra.Text.Trim();
            GlobalSetting.SetConfig("ExtraExtensions", GlobalSetting.SupportedExtraExtensions);

            //Ép thực thi các thiết lập
            GlobalSetting.IsForcedActive = true;
        }
Ejemplo n.º 6
0
        private void SettingControl_SetConfigFile()
        {
            if (GlobalSetting.IsLoadGlobalSetting == false)
            {
                MainForm.ShowPopupMessage("正在初始化数据", "请稍等片刻。。。");
                ProcessForm.StartProcessForm(Process_InitializeLoad);
            }

            if (m_ConfigForm.ShowDialog() == DialogResult.OK)
            {
                if (GlobalSetting.LoadGlobalSetting() == false)
                {
                    MainForm.ShowPopupMessage("读取配置文件失败!", "可能文件不存在或格式错误。。。");
                    return;
                }

                ProcessForm.StartProcessForm(Process_Initialize);
            }
        }
        /// <summary>
        /// Retrieves GlobalSetting object from SqlCommand, after database query
        /// </summary>
        /// <param name="cmd">The command object to use for query</param>
        /// <returns>GlobalSetting object</returns>
        private GlobalSetting GetObject(SqlCommand cmd)
        {
            SqlDataReader reader;
            long          rows = SelectRecords(cmd, out reader);

            using (reader)
            {
                if (reader.Read())
                {
                    GlobalSetting globalSettingObject = new GlobalSetting();
                    FillObject(globalSettingObject, reader);
                    return(globalSettingObject);
                }
                else
                {
                    return(null);
                }
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Insert new globalSetting.
 /// data manipulation for insertion of GlobalSetting
 /// </summary>
 /// <param name="globalSettingObject"></param>
 /// <returns></returns>
 private bool Insert(GlobalSetting globalSettingObject)
 {
     // new globalSetting
     using (GlobalSettingDataAccess data = new GlobalSettingDataAccess(ClientContext))
     {
         // insert to globalSettingObject
         Int32 _Id = data.Insert(globalSettingObject);
         // if successful, process
         if (_Id > 0)
         {
             globalSettingObject.Id = _Id;
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Ejemplo n.º 9
0
        protected virtual SmtpClient GenerateSmtpClient()
        {
            return(base.ExecuteFunction("GenerateSmtpClient", delegate()
            {
                //TODO:MUST:Email: Cache these configurations when properly building this feature
                SmtpCredential credentials = new SmtpCredential();
                List <GlobalSetting> items = this.API.Direct.GlobalSettings.FindWithPrefix("Email_");
                GlobalSetting item = items.FirstOrDefault(x => x.name == "Email_SmtpUserName" && !string.IsNullOrEmpty(x.value));
                if (item != null)
                {
                    credentials.SmtpUserName = item.value;
                }
                item = items.FirstOrDefault(x => x.name == "Email_SmtpUseSSL" && !string.IsNullOrEmpty(x.value));
                if (item != null)
                {
                    credentials.SmtpUseSSL = bool.Parse(item.value);
                }
                item = items.FirstOrDefault(x => x.name == "Email_SmtpPort" && !string.IsNullOrEmpty(x.value));
                if (item != null)
                {
                    credentials.SmtpPort = int.Parse(item.value);
                }
                item = items.FirstOrDefault(x => x.name == "Email_SmtpPassword" && !string.IsNullOrEmpty(x.value));
                if (item != null)
                {
                    credentials.SmtpPassword = item.value;
                }
                item = items.FirstOrDefault(x => x.name == "Email_SmtpHostName" && !string.IsNullOrEmpty(x.value));
                if (item != null)
                {
                    credentials.SmtpHostName = item.value;
                }

                SmtpClient smtpClient = new SmtpClient(credentials.SmtpHostName);
                if (credentials.SmtpPort != 0)
                {
                    smtpClient.Port = credentials.SmtpPort;
                }
                smtpClient.Credentials = new System.Net.NetworkCredential(credentials.SmtpUserName, credentials.SmtpPassword);
                smtpClient.EnableSsl = credentials.SmtpUseSSL;
                return smtpClient;
            }));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Load language list
        /// </summary>
        private void LoadLanguageList()
        {
            cmbLanguage.Items.Clear();
            cmbLanguage.Items.Add("English");


            _langList = new List <Language>
            {
                new Language()
            };

            string langPath = Path.Combine(GlobalSetting.StartUpDir, "Languages");

            if (!Directory.Exists(langPath))
            {
                Directory.CreateDirectory(langPath);
            }
            else
            {
                foreach (string f in Directory.GetFiles(langPath))
                {
                    if (Path.GetExtension(f).ToLower() == ".iglang")
                    {
                        Language l = new Language(f);
                        _langList.Add(l);

                        int    iLang   = cmbLanguage.Items.Add(l.LangName);
                        string curLang = GlobalSetting.GetConfig("Language", "English");

                        //using current language pack
                        if (f.CompareTo(curLang) == 0)
                        {
                            cmbLanguage.SelectedIndex = iLang;
                        }
                    }
                }
            }

            if (cmbLanguage.SelectedIndex == -1)
            {
                cmbLanguage.SelectedIndex = 0;
            }
        }
Ejemplo n.º 11
0
        //得到录音初统计表成绩初统计表切片的天以上切片的数据的统计
        /// <summary>
        ///
        /// </summary>
        /// <param name="ADataBaseConfig"></param>
        /// <param name="AGlobalSetting"></param>
        /// <param name="TableName"></param>
        /// <param name="ColumnName"></param>
        /// <param name="ObjectType">// 1座席 2分机  3用户 4真实分机 5机构  6 技能组</param>
        /// <param name="StartTimeLocal"></param>
        /// <param name="StopTimeLocal"></param>
        /// <param name="ObjectSerialID"></param>
        /// <returns></returns>
        public static double GetStatisticsValueDayUp(DataBaseConfig ADataBaseConfig, GlobalSetting AGlobalSetting, string TableName, string ColumnName, int ObjectType, string StartTimeLocal, string StopTimeLocal, string ObjectSerialID)
        {
            double    Value01          = 0;
            DataTable LDataTableReturn = new DataTable();
            string    LStrDynamicSQL   = string.Empty;
            string    LStrRentToken    = AGlobalSetting.StrRent;
            string    LStrSingleObject = string.Empty;
            string    LColumnName      = ColumnName;

            try
            {
                LStrDynamicSQL = string.Format("SELECT ISNULL(SUM({0}),0) AS Value01  FROM {6} WHERE C001={1} AND C002={2} AND C003 IN (SELECT C011 FROM T_00_901 WHERE C001 = {3})  AND C006>={4} AND C006<{5} ",
                                               LColumnName,
                                               ObjectType,
                                               LStrRentToken,
                                               ObjectSerialID,
                                               StartTimeLocal,
                                               StopTimeLocal,
                                               TableName);

                FileLog.WriteInfo("GetDayRecordStatistics()", LStrDynamicSQL);
                DatabaseOperation01Return LDatabaseOperationReturn = new DatabaseOperation01Return();
                DataOperations01          LDataOperations          = new DataOperations01();
                LDatabaseOperationReturn = LDataOperations.SelectDataByDynamicSQL(ADataBaseConfig.IntDatabaseType, ADataBaseConfig.StrDatabaseProfile, LStrDynamicSQL);
                if (!LDatabaseOperationReturn.BoolReturn)
                {
                    LDataTableReturn = null;
                }
                else
                {
                    LDataTableReturn = LDatabaseOperationReturn.DataSetReturn.Tables[0];
                    foreach (DataRow LDataRowSingleRow in LDataTableReturn.Rows)
                    {
                        Value01 += DoubleParse(LDataRowSingleRow["Value01"].ToString(), 0);
                    }
                }
            }
            catch (Exception ex)
            {
                FileLog.WriteInfo("GetDayRecordStatistics()", "Error :" + ex.Message);
            }
            return(Value01);
        }
Ejemplo n.º 12
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Directory.CreateDirectory(GlobalSetting.ConfigDir(Dir.Temporary));

            picStatus.Image = igcmd.Properties.Resources.loading;
            Thread t = new Thread(new ThreadStart(CheckForUpdate))
            {
                Priority     = ThreadPriority.BelowNormal,
                IsBackground = true
            };

            t.Start();

            FileVersionInfo fv = FileVersionInfo.GetVersionInfo(GlobalSetting.StartUpDir("ImageGlass.exe"));

            txtUpdates.Text = $"Current version: {fv.FileVersion}\r\n------------------------------\r\n\r\n";

            //CheckForUpdate();
        }
Ejemplo n.º 13
0
        public void 使用连接池内缓存的TTransport请求_线程延时以达到最大的缓存限制()
        {
            int threadCount = 1000;
            int count       = 0;

            for (int i = 0; i < threadCount; i++)
            {
                Thread thread = new Thread(() =>
                {
                    UserService.Iface userService = GlobalSetting.GetService <UserService.Iface>();
                    for (int j = 0; j < 10; j++)
                    {
                        UserInfo user = userService.GetUser(10);
                    }
                    Thread.Sleep(1000);
                    IDisposable dispose = userService as IDisposable;
                    dispose.Dispose();
                    Interlocked.Increment(ref count);
                });
                thread.Start();
            }
            bool timeout = false;

            //Timer timer = new Timer((state) => timeout = true,null,10000,-1);
            while (count < threadCount && !timeout)
            {
            }
            if (timeout)
            {
                Console.WriteLine($"超时:执行成功{count}次");
            }
            else
            {
                Console.WriteLine($"正常结束:执行成功{count}次");
            }
            ThriftConnectionPool pool = GlobalSetting.GetService <IThriftConnectionPool>() as ThriftConnectionPool;

            foreach (var item in pool.ConnectionStore.ConnectionPool)
            {
                Console.WriteLine("连接池内的TTransport:" + item.Value.Count);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Get and load value of General tab
        /// </summary>
        private void LoadTabGeneralConfig()
        {
            //Get value of chkWelcomePicture ----------------------------------------------------
            chkWelcomePicture.Checked = GlobalSetting.IsShowWelcome;

            //Get value of chkShowToolBar
            chkShowToolBar.Checked = GlobalSetting.IsShowToolBar;

            //Get Portable mode value -----------------------------------------------------------
            chkPortableMode.Checked = GlobalSetting.IsPortableMode;
            if (!GlobalSetting.CheckStartUpDirWritable())
            {
                chkPortableMode.Enabled = false;
            }

            //Get value of cmbAutoUpdate --------------------------------------------------------
            string configValue = GlobalSetting.GetConfig("AutoUpdate", DateTime.Now.ToString());

            if (configValue != "0")
            {
                chkAutoUpdate.Checked = true;
            }
            else
            {
                chkAutoUpdate.Checked = false;
            }

            //Get value of IsAllowMultiInstances
            chkAllowMultiInstances.Checked = GlobalSetting.IsAllowMultiInstances;

            //Get value of IsPressESCToQuit
            chkESCToQuit.Checked = GlobalSetting.IsPressESCToQuit;

            //Get value of IsConfirmationDelete
            chkConfirmationDelete.Checked = GlobalSetting.IsConfirmationDelete;

            //Get value of IsScrollbarsVisible
            chkShowScrollbar.Checked = GlobalSetting.IsScrollbarsVisible;

            //Get background color
            picBackgroundColor.BackColor = GlobalSetting.BackgroundColor;
        }
Ejemplo n.º 15
0
 public IComponent Create(string ComponentName, string ComponentDescription,
                          ComponentType componentType, string primarykeys, string titlePattern)
 {
     if (componentType == ComponentType._CoreComponent)
     {
         Business bc = new Business();
         bc.ComponentName        = ComponentName;
         bc.ComponentDescription = ComponentDescription;
         bc.Type         = componentType;
         bc.TitlePattern = titlePattern;
         bc.PrimaryKeys  = primarykeys.Split(',').ToList();
         return(bc);
     }
     else if (componentType == ComponentType._GlobalComponent)
     {
         GlobalSetting gb = new GlobalSetting();
         gb.ComponentName        = ComponentName;
         gb.TitlePattern         = titlePattern;
         gb.ComponentDescription = ComponentDescription;
         gb.Type        = ComponentType._GlobalComponent;
         gb.PrimaryKeys = primarykeys.Split(',').ToList();
         return(gb);
     }
     else if (componentType == ComponentType._ComponentAttribute)
     {
         throw new Exception("Cannot find parentcomponent missing");
     }
     else if (componentType == ComponentType._ComponentTransaction)
     {
         Transaction bc = new Transaction();
         bc.ComponentName        = ComponentName;
         bc.ComponentDescription = ComponentDescription;
         bc.Type         = componentType;
         bc.TitlePattern = titlePattern;
         bc.PrimaryKeys  = primarykeys.Split(',').ToList();
         return(bc);
     }
     else
     {
         return(null);
     }
 }
        public async void InitHome()
        {
            // Llamamos al servicio API
            this.PageDialog.ShowLoading("Cargando información");
            var apiUsers = await ApiManager.GetDataUsers();

            if (!apiUsers.IsSuccessStatusCode)
            {
                this.PageDialog.HideLoading();
                await PageDialog.AlertAsync("Algo salió mal, no se pueden obtener datos", "Error", "Aceptar");

                return;
            }
            var jsonResponse = await apiUsers.Content.ReadAsStringAsync();

            var responseAlistamiento = await Task.Run(() => JsonConvert.DeserializeObject <List <HomeModel> >(jsonResponse));

            GlobalSetting.GetInstance().Users = responseAlistamiento;
            this.PageDialog.HideLoading();
        }
Ejemplo n.º 17
0
        private void LoadGlobalSetting()
        {
            try
            {
                using (var prestoWcf = new PrestoWcf <IBaseService>())
                {
                    this.GlobalSetting = prestoWcf.Service.GetGlobalSettingItem();
                }

                if (this.GlobalSetting == null)
                {
                    this.GlobalSetting = new GlobalSetting();
                }
            }
            catch (Exception ex)
            {
                CommonUtility.ProcessException(ex);
                ViewModelUtility.MainWindowViewModel.AddUserMessage("Could not load form. Please see log for details.");
            }
        }
Ejemplo n.º 18
0
        public static IDeviceManager ResolveIDeviceManager()
        {
            IDeviceManager manager = null;
            Thread         thread  = new Thread(delegate {
                Thread.CurrentThread.SetApartmentState(ApartmentState.MTA);
                try
                {
                    manager = new DeviceManager(GlobalSetting.GetApplicationSetting("MockDeviceCount") as long?);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString());
                    throw;
                }
            });

            thread.Start();
            thread.Join();
            return(manager);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 根据一月得到一个月的开始时间和起始时间
        /// </summary>
        /// <param name="ADatetime"></param>
        /// <param name="AGlodbalSetting"></param>
        /// <returns></returns>
        public static DateTimeSplite GetMonthStartAndStopTime(DateTime ADatetime, GlobalSetting AGlodbalSetting)
        {
            DateTimeSplite LDateTimeSplite   = new DateTimeSplite();
            int            LIntMonthStartSet = IntParse(AGlodbalSetting.StrMonthStart, 0);
            //1为1号 2为2号 26为26号
            DateTime LDateTimeTemp = new DateTime(ADatetime.Year, ADatetime.Month, LIntMonthStartSet);

            if (ADatetime < LDateTimeTemp)
            {
                LDateTimeSplite.StopStatisticsTime  = LDateTimeTemp.AddMonths(1);
                LDateTimeSplite.StartStatisticsTime = LDateTimeTemp;
            }
            else
            {
                LDateTimeSplite.StartStatisticsTime = LDateTimeTemp;
                LDateTimeSplite.StopStatisticsTime  = LDateTimeTemp.AddMonths(1);
            }

            return(LDateTimeSplite);
        }
Ejemplo n.º 20
0
        private void frmSetting_Load(object sender, EventArgs e)
        {
            //Remove tabs header
            tab1.Appearance = TabAppearance.FlatButtons;
            tab1.ItemSize   = new Size(0, 1);
            tab1.SizeMode   = TabSizeMode.Fixed;

            //Load config
            //Windows Bound (Position + Size)-------------------------------------------
            Rectangle rc = GlobalSetting.StringToRect(GlobalSetting.GetConfig($"{Name}.WindowsBound", "280,125,610,570"));

            if (!Helper.IsOnScreen(rc.Location))
            {
                rc.Location = new Point(280, 125);
            }
            Bounds = rc;

            //windows state--------------------------------------------------------------
            string s = GlobalSetting.GetConfig(Name + ".WindowsState", "Normal");

            if (s == "Normal")
            {
                WindowState = FormWindowState.Normal;
            }
            else if (s == "Maximized")
            {
                WindowState = FormWindowState.Maximized;
            }

            //Get the last view of tab --------------------------------------------------
            tab1.SelectedIndex = GlobalSetting.SettingsTabLastView;
            tab1_SelectedIndexChanged(tab1, null); //Load tab's configs

            //Load configs
            LoadTabGeneralConfig();
            LoadTabImageConfig();
            lnkRefresh_LinkClicked(null, null);


            InitLanguagePack();
        }
Ejemplo n.º 21
0
        private void frmExtension_Load(object sender, EventArgs e)
        {
            //Load config
            //Windows Bound (Position + Size)--------------------------------------------
            Rectangle rc = GlobalSetting.StringToRect(GlobalSetting.GetConfig($"{Name}.WindowsBound", "280,125,850,550"));

            if (!Helper.IsOnScreen(rc.Location))
            {
                rc.Location = new Point(280, 125);
            }
            Bounds = rc;

            //windows state--------------------------------------------------------------
            string s = GlobalSetting.GetConfig($"{Name}.WindowsState", "Normal");

            if (s == "Normal")
            {
                WindowState = FormWindowState.Normal;
            }
            else if (s == "Maximized")
            {
                WindowState = FormWindowState.Maximized;
            }

            //Apply Windows theme
            RenderTheme r = new RenderTheme();

            r.ApplyTheme(tvExtension);

            //load extensions
            LoadExtensions();

            //Load language:
            Text = GlobalSetting.LangPack.Items["frmExtension._Text"];
            btnRefreshAllExt.Text = GlobalSetting.LangPack.Items["frmExtension.btnRefreshAllExt"];
            btnGetMoreExt.Text    = GlobalSetting.LangPack.Items["frmExtension.btnGetMoreExt"];
            btnInstallExt.Text    = GlobalSetting.LangPack.Items["frmExtension.btnInstallExt"];
            btnClose.Text         = GlobalSetting.LangPack.Items["frmExtension.btnClose"];

            RightToLeft = GlobalSetting.LangPack.IsRightToLeftLayout;
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Register URI Scheme for Web-to-App linking
        /// </summary>
        /// <returns></returns>
        public static int SetURIScheme()
        {
            DeleteURIScheme();


            string         baseKey = $@"SOFTWARE\Classes\{GlobalSetting.URI_SCHEME}";
            RegistryHelper reg     = new RegistryHelper
            {
                ShowError       = true,
                BaseRegistryKey = Registry.CurrentUser,
                SubKey          = baseKey
            };

            if (!reg.Write("", "URL: ImageGlass Protocol"))
            {
                return(1);
            }

            if (!reg.Write("URL Protocol", ""))
            {
                return(1);
            }


            // DefaultIcon
            reg.SubKey = $@"{baseKey}\DefaultIcon";
            if (!reg.Write("", $"\"{GlobalSetting.StartUpDir("ImageGlass.exe")}\", 0"))
            {
                return(1);
            }


            // shell\open\command
            reg.SubKey = $@"{baseKey}\shell\open\command";
            if (!reg.Write("", $"\"{GlobalSetting.StartUpDir("ImageGlass.exe")}\" \"%1\""))
            {
                return(1);
            }

            return(0);
        }
Ejemplo n.º 23
0
        //天切片
        #endregion

        public void DoAction(DataBaseConfig ADataBaseConfig, ServiceConfigInfo AServiceConfigInfo, GlobalSetting AGolbalSetting)
        {
            try
            {
                //得到全局参数
                this.IDataBaseConfig    = ADataBaseConfig;
                this.IServiceConfigInfo = AServiceConfigInfo;
                this.IGlobalSetting     = AGolbalSetting;

                //得到全部的座席
                List <ObjectInfo> lstAgentInfo = new List <ObjectInfo>();
                DALAgentInfo.GetAllAgentInfo(IDataBaseConfig, ref lstAgentInfo, IGlobalSetting);
                foreach (ObjectInfo agent in lstAgentInfo)
                {
                    DoTimeSplitStatistics(agent);
                    Thread.Sleep(10);
                }

                //得到全部的分机
                lstAgentInfo.Clear();
                DALExtensionInfo.GetAllExtensionInfo(IDataBaseConfig, ref lstAgentInfo, IGlobalSetting);
                foreach (ObjectInfo extension in lstAgentInfo)
                {
                    DoTimeSplitStatistics(extension);
                    Thread.Sleep(10);
                }

                //得到全部的用户
                lstAgentInfo.Clear();
                DALUserInfo.GetAllUserInfo(IDataBaseConfig, IGlobalSetting, ref lstAgentInfo);
                foreach (ObjectInfo user in lstAgentInfo)
                {
                    DoTimeSplitStatistics(user);
                    Thread.Sleep(10);
                }
            }
            catch (Exception ex)
            {
                FileLog.WriteError("QMStatistics().DoAction", ex.Message);
            }
        }
        public static Type GetTypeFromAssemblies(string serviceInterfaceStr)
        {
            IServiceAssembliesResolver assembliesResolver = GlobalSetting.GetService <IServiceAssembliesResolver>();

            if (assembliesResolver == null)
            {
                throw new NullReferenceException("IServiceAssembliesResolver接口不能为空");
            }
            IEnumerable <Assembly> assemblies = assembliesResolver.GetAssemblies();

            foreach (Assembly assembly in assemblies.Where(tmp => tmp != null))
            {
                Type interfaceType = assembly.GetType(serviceInterfaceStr);
                if (interfaceType != null)
                {
                    return(interfaceType);
                }
            }

            return(null);
        }
        private void ButtonOK_Click(object sender, EventArgs e)
        {
            LHPPrimaryScanInfo getLHPScanInfo = this.GetLHPPrimaryScanInfo();

            GlobalSetting.SaveLHPPrimaryScanInfo(GlobalSetting.LHPPrimaryScanInfoFilePath, getLHPScanInfo);

            List <SRReport> srReportList = new List <SRReport>();

            //foreach ( StockFileInfo stockFileInfo in MainForm.Instance.OptionForm.GetStockFileInfos() )
            //{
            //    SRReport srReport = GlobalSetting.ScanSRStaticData( stockFileInfo, getLHPScanInfo );
            //    if ( srReport != null )
            //        srReportList.Add( srReport );
            //}

            GlobalSetting.SRReports = srReportList.ToArray();
            //MainForm.Instance.LoadNewFile_Static();
            //MainForm.Instance.LoadNewFile_Dynamic();

            this.Close();
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 得到所有的用户信息
        /// </summary>
        /// <param name="AListUserInfo"></param>
        /// <param name="AStrRent"></param>
        public static void GetAllUserInfo(DataBaseConfig ADataBaseConfig, GlobalSetting AGolbalSetting, ref List <ObjectInfo> AListUserInfo)
        {
            AListUserInfo.Clear();
            DataTable LDataTableReturn = new DataTable();
            string    LStrDynamicSQL   = string.Empty;
            string    LStrRentToken    = string.Empty;
            string    LStrSingleObject = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperationReturn = new DatabaseOperation01Return();
                DataOperations01          LDataOperations          = new DataOperations01();

                LStrDynamicSQL = string.Format("SELECT * FROM T_11_005_{0} WHERE C007<>'H' AND C010='1' AND C011='0' "
                                               , AGolbalSetting.StrRent);
                LDatabaseOperationReturn = LDataOperations.SelectDataByDynamicSQL(ADataBaseConfig.IntDatabaseType, ADataBaseConfig.StrDatabaseProfile, LStrDynamicSQL);
                if (!LDatabaseOperationReturn.BoolReturn)
                {
                    LDataTableReturn = null;
                }
                else
                {
                    LDataTableReturn = LDatabaseOperationReturn.DataSetReturn.Tables[0];
                    foreach (DataRow LDataRowSingleRow in LDataTableReturn.Rows)
                    {
                        ObjectInfo userInfoTemp = new ObjectInfo();
                        userInfoTemp.ObjID       = LongParse(LDataRowSingleRow["C001"].ToString(), 0);
                        userInfoTemp.ObjName     = EncryptionAndDecryption.EncryptDecryptString(LDataRowSingleRow["C002"].ToString(), IStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                        userInfoTemp.BeyondOrgID = LongParse(LDataRowSingleRow["C006"].ToString(), 0);
                        userInfoTemp.ObjType     = 3;
                        AListUserInfo.Add(userInfoTemp);
                    }
                }
            }
            catch (Exception ex)
            {
                LDataTableReturn = null;
                FileLog.WriteInfo("GetAllUserInfo()", ex.Message);
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Register file association
        /// </summary>
        /// <param name="exts">Extensions, for ex: *.png;*.jpg</param>
        /// <param name="appPath">Executable file</param>
        public static void RegisterAssociation(string appPath, string exts)
        {
            string[] ext_list = exts.Replace("*", "").Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string ext in ext_list)
            {
                FileAssociationInfo fa = new FileAssociationInfo(ext);
                if (!fa.Exists)
                {
                    return;
                }

                ProgramAssociationInfo pa = new ProgramAssociationInfo(fa.ProgID);

                if (!pa.Exists)
                {
                    return;
                }

                ProgramVerb[]      verbs = pa.Verbs;
                List <ProgramVerb> l     = new List <ProgramVerb>();
                l.AddRange(verbs);

                //remove existed verb
                ProgramVerb openVerb = l.SingleOrDefault(v => v.Name == "open");
                if (openVerb != null)
                {
                    l.Remove(openVerb);
                }

                //add new value
                openVerb = new ProgramVerb("open", "\"" + appPath + "\" \"%1\"");
                l.Add(openVerb);

                //save & apply changes
                pa.Verbs = l.ToArray();

                GlobalSetting.SetConfig("ContextMenuExtensions", exts);
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Check for update
        /// </summary>
        public static void AutoUpdate()
        {
            Update up = new Update(new Uri("http://www.imageglass.org/checkforupdate"),
                                   GlobalSetting.StartUpDir + "update.xml");

            if (File.Exists(GlobalSetting.StartUpDir + "update.xml"))
            {
                File.Delete(GlobalSetting.StartUpDir + "update.xml");
            }

            //save last update
            GlobalSetting.SetConfig("AutoUpdate", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));

            if (up.CheckForUpdate(Application.StartupPath + "\\ImageGlass.exe") &&
                up.Info.VersionType.ToLower() == "stable")
            {
                frmCheckForUpdate f = new frmCheckForUpdate();
                f.ShowDialog();
            }

            Application.Exit();
        }
Ejemplo n.º 29
0
        private void frmColorPicker_Load(object sender, EventArgs e)
        {
            UpdateUI();

            //Windows Bound (Position + Size)-------------------------------------------
            Rectangle rc = GlobalSetting.StringToRect("0,0,300,160");

            if (rc.X == 0 && rc.Y == 0)
            {
                _locationOffset = DefaultLocationOffset;
                parentOffset    = _locationOffset;

                _SetLocationBasedOnParent();
            }
            else
            {
                this.Location = rc.Location;
            }

            _ResetColor();


            lblRGB.Text = "RGB:";
            lblHEX.Text = "HEX:";
            lblHSL.Text = "HSL:";

            if (GlobalSetting.IsColorPickerRGBA)
            {
                lblRGB.Text = "RGBA:";
            }
            if (GlobalSetting.IsColorPickerHEXA)
            {
                lblHEX.Text = "HEXA:";
            }
            if (GlobalSetting.IsColorPickerHSLA)
            {
                lblHSL.Text = "HSLA:";
            }
        }
Ejemplo n.º 30
0
    // 加载表格
    public IEnumerator GetCSV()
    {
        // 用WWW读取配置表
        WWW www = new WWW(GlobalSetting.ConvertToAssetBundleName("BundleData.csv"));

        while (!www.isDone)
        {
            yield return(www);
        }
        CsvBundleData bundleCsv = new CsvBundleData(www.text);

        bundleCsv.ReadCsvFile();
        bundleDic = bundleCsv.CsvDataDic;

        //for (int i = 0; i < bundleDic.Count; i++)
        //{
        //    StartCoroutine(LoadAssetBundles(bundleDic[i].Type, typeof(GameObject)));
        //}
        //TextLog.text = "开始加载AssetBundle:" + "    " + Application.streamingAssetsPath + "                  " + GlobalSetting.getplatformfolder();

        StartCoroutine(LoadAssetBundles(bundleDic));
    }
Ejemplo n.º 31
0
 /// <summary>
 /// Creates a setting with Name, Value & Description
 /// </summary>
 /// <param name="Name">name of setting</param>
 /// <param name="Value">value of setting</param>
 /// <param name="Description">description of setting</param>
 public void CreateSetting(string Name, string Value, string Description)
 {
     if (GetSettingByName(Name) != null)
     {
         UpdateSetting(Name, Value);
         return;
     }
     using (var dc = (new DCFactory<dcCommonDataContext>()).DataContext)
     {
         var setting = new GlobalSetting();
         setting.Name = Name;
         setting.Value = Value;
         setting.Description = Description;
         dc.GlobalSettings.InsertOnSubmit(setting);
         dc.SubmitChanges();
     }
     RetrieveAllSettings();
 }
Ejemplo n.º 32
0
 void Awake()
 {
     m_Instance = this;
 }
Ejemplo n.º 33
0
 void OnDestroy()
 {
     m_Instance = null;
 }
Ejemplo n.º 34
0
 void Awake(){
   m_Instance = this;
   players = new ArrayList();
   alivePlayers = new ArrayList();
 }