Пример #1
0
        private void Settings_Load(object sender, EventArgs e)
        {
            //#TAX
            // profile tax
            //tax_profile_groupBox.Visible = tax_profile_bottomSpacer.Visible = ConfigManager.Instance.CommonConfiguration.PROFILES_UseProfiles;

            //#COMMON
            //PayDesk
            sys_gen_kasaNom.Value = ConfigManager.Instance.CommonConfiguration.APP_PayDesk;
            //RefreshRate
            system_common_numericUpDown_refreshRate.Value = ConfigManager.Instance.CommonConfiguration.APP_RefreshRate / 1000;
            //SubUnit
            sys_gen_pidrozd.Value = ConfigManager.Instance.CommonConfiguration.APP_SubUnit;
            //DefaultCountOfArticle
            system_common_textBox_startupQuantity.Text = ConfigManager.Instance.CommonConfiguration.APP_StartTotal.ToString();
            //SubUnitName
            system_common_textBox_subunitName.Text = ConfigManager.Instance.CommonConfiguration.APP_SubUnitName;
            //Customer's ID
            system_common_textBox_defaultcustomerID.Text = ConfigManager.Instance.CommonConfiguration.APP_ClientID;
            //WeightType
            system_common_comboBox_weightType.SelectedIndex = ConfigManager.Instance.CommonConfiguration.APP_WeightType;
            //DefaultSearchType
            system_common_comboBox_searchType.SelectedIndex = ConfigManager.Instance.CommonConfiguration.APP_SearchType;
            //Search Types Access
            // --> realized in Event (comboBox2_SelctedIndexChanged)

            //#PATH
            this.System_Path_txbox_folderArticles.Text = ConfigManager.Instance.CommonConfiguration.Path_Articles;
            this.System_Path_txbox_folderCheques.Text = ConfigManager.Instance.CommonConfiguration.Path_Cheques;
            this.System_Path_txbox_folderTemp.Text = ConfigManager.Instance.CommonConfiguration.Path_Temp;
            this.System_Path_txbox_folderBills.Text = ConfigManager.Instance.CommonConfiguration.Path_Bills;
            this.System_Path_txbox_folderUserSchemas.Text = ConfigManager.Instance.CommonConfiguration.Path_Schemes;
            this.System_Path_txbox_folderExchange.Text = ConfigManager.Instance.CommonConfiguration.Path_Exchnage;
            this.System_Path_txbox_folderUsers.Text = ConfigManager.Instance.CommonConfiguration.Path_Users;
            this.System_Path_txbox_folderTemplates.Text = ConfigManager.Instance.CommonConfiguration.Path_Templates;
            this.System_Path_txbox_folderPlugins.Text = ConfigManager.Instance.CommonConfiguration.Path_Plugins;
            this.System_Path_txbox_folderReports.Text = ConfigManager.Instance.CommonConfiguration.Path_Reports;

            //#ADDITIONAL
            //Timeout request of refresh
            numericUpDown6.Value = ConfigManager.Instance.CommonConfiguration.APP_RefreshTimeout;
            //ChequeName
            maskedTextBox1.Text = ConfigManager.Instance.CommonConfiguration.APP_ChequeName;
            //Invent auto save
            numericUpDown3.Value = ConfigManager.Instance.CommonConfiguration.APP_InvAutoSave;
            //Language
            comboBox5.SelectedItem = ConfigManager.Instance.CommonConfiguration.APP_Language;
            //Total digits after point of money
            numericUpDown2.Value = ConfigManager.Instance.CommonConfiguration.APP_MoneyDecimals;
            //Total digits after point of dose
            numericUpDown4.Value = ConfigManager.Instance.CommonConfiguration.APP_DoseDecimals;
            //Clear temp on exit
            checkBox6.Checked = ConfigManager.Instance.CommonConfiguration.APP_ClearTEMPonExit;
            //Show info on indicator
            checkBox7.Checked = ConfigManager.Instance.CommonConfiguration.APP_ShowInfoOnIndicator;
            //Invent window
            checkBox4.Checked = ConfigManager.Instance.CommonConfiguration.APP_ShowInventWindow;
            //One copy
            checkBox5.Checked = ConfigManager.Instance.CommonConfiguration.APP_AllowOneCopy;
            //Barcode
            scaner_cBox_useProgramMode.Checked = ConfigManager.Instance.CommonConfiguration.APP_ScannerUseProgamMode;
            scanner_char_frequency.Value = (decimal)ConfigManager.Instance.CommonConfiguration.APP_ScannerCharReadFrequency;
            system_cBox_buyerBCReader.SelectedIndex = ConfigManager.Instance.CommonConfiguration.APP_BuyerBarCodeSource;
            system_num_buyerBCMinLen.Value = (decimal)ConfigManager.Instance.CommonConfiguration.APP_BuyerBarCodeMinLen;

            // PAGE: Content
            // -TabControl: Main
            // --TabPage: Common
            this.content_general_checkBox_showPromptMsgOnIllegal.Checked = ConfigManager.Instance.CommonConfiguration.Content_Common_PromptMsgOnIllegal;
            this.content_general_numeric_printDelay.Value = ConfigManager.Instance.CommonConfiguration.Content_Common_PrinterDelaySec;
            // --TabPage: Cheques
            // Add total
            switch (ConfigManager.Instance.CommonConfiguration.Content_Cheques_AddTotal)
            {
                case "none": this.content_order_radioButton_addQuantity1.Checked = true; break;
                case "type1": this.content_order_radioButton_addQuantity2.Checked = true; break;
                case "type2": this.content_order_radioButton_addQuantity3.Checked = true; break;
            }
            // split articles to different cheques
            // removed this.content_chq_chBox_useSeparateCheque.Checked = ConfigManager.Instance.CommonConfiguration.Content_Cheques_UseSeparateCheque;
            // removed this.content_chq_textBox_separatedArticleMaskById.Text = ConfigManager.Instance.CommonConfiguration.Content_Cheques_SeparatedArticleMaskById;
            // use custom client's card
            this.content_chq_chBox_useCustomClientCardBC.Checked = ConfigManager.Instance.CommonConfiguration.Content_Cheques_UseCustomClientCardBC;
            this.content_chq_textBox_customClientCardBC.Text = ConfigManager.Instance.CommonConfiguration.Content_Cheques_CustomClientCardBC;
            // use secure backup
            this.content_chq_chBox_addCopyToArchive.Checked = ConfigManager.Instance.CommonConfiguration.Content_Cheques_AddCopyToArchive;
            //Client Card
            this.content_chq_textBox_customClientCardBC.Text = ConfigManager.Instance.CommonConfiguration.Content_Cheques_CustomClientCardBC;
            // --TabPage: Bills
            this.checkBox_pBills_DeleteBillAtEnd.Checked = ConfigManager.Instance.CommonConfiguration.Content_Bills_KeepAliveAfterCheque;
            this.content_bill_chBox_addCopyToArchive.Checked = ConfigManager.Instance.CommonConfiguration.Content_Bills_AddCopyToArchive;
            this.checkBox_pBills_ShowBillSumColumn.Checked = ConfigManager.Instance.CommonConfiguration.Content_Bills_ShowBillSumColumn;
            this.checkBox_pBills_ShowBillTotalSum.Checked = ConfigManager.Instance.CommonConfiguration.Content_Bills_ShowBillTotalSum;
            // --TabPage: Articles
            this.checkBox_pArticles_KeepOriginData.Checked = ConfigManager.Instance.CommonConfiguration.Content_Articles_KeepDataAfterImport;

            // Profiles
            this.profiles_chq_chBox_useProfiles.Checked = ConfigManager.Instance.CommonConfiguration.PROFILES_UseProfiles;

            Hashtable ht = new Hashtable();
            if (ConfigManager.Instance.CommonConfiguration.PROFILES_Items == null)
                ConfigManager.Instance.CommonConfiguration.PROFILES_Items = new Hashtable();
            Hashtable profiles = new Hashtable();
            foreach (DictionaryEntry di in ConfigManager.Instance.CommonConfiguration.PROFILES_Items)
            {
                try
                {
                    ht = (Hashtable)di.Value;

                    // data fill
                    wndSettings.uc_firmEntry fe = new wndSettings.uc_firmEntry(di.Key, ht);

                    // style
                    fe.BackColor = Color.White;
                    fe.Dock = DockStyle.Fill;

                    // adding new tab
                    TabPage tp = new TabPage();
                    tp.ImageIndex = 0;
                    tp.Controls.Add(fe);
                    profiles_tab_profiles.TabPages.Add(tp);
                    profiles_tab_profiles.SelectedTab = tp;

                    profiles[di.Key] = ht["NAME"];
                }
                catch { }
            }
            profiles_tab_profiles.Visible = !(profiles_tab_profiles.TabPages.Count == 0);
            // profiles legal item
            //profiles["-"] = "-";
            BindingSource bs = new BindingSource();
            BindingSource bs_legal = new BindingSource();
            profiles[CoreConst.KEY_DEFAULT_PROFILE_ID] = "-";
            bs.DataSource = profiles;
            bs_legal.DataSource = profiles;
            this.tax_profile_cBox.DataSource = bs;
            this.tax_profile_cBox.DisplayMember = "Value";

            this.profiles_cBox_legalProfile.DataSource = bs_legal;
            this.profiles_cBox_legalProfile.DisplayMember = "Value";
            try
            {
                foreach (DictionaryEntry di in this.profiles_cBox_legalProfile.Items)
                {
                    if (ConfigManager.Instance.CommonConfiguration.PROFILES_LegalProgileID.Equals(di.Key))
                    {
                        this.profiles_cBox_legalProfile.SelectedItem = di;
                        break;
                    }
                }
            }
            catch { }

            // tax

            Settings_Tax_Grid(CoreConst.KEY_DEFAULT_PROFILE_ID);
            this.tax_profile_cBox.SelectedIndex = 0;

            //Navigator
            treeView1.Select();
            treeView1.SelectedNode = treeView1.Nodes[0];
        }
Пример #2
0
        private void button_Click(object sender, EventArgs e)
        {
            Control linkedCtrl = new Control();
            switch (((Control)sender).Name)
            {
                case "System_Path_btn_folderArticlesBrowse":
                    {
                        folderBrowserDialog1.Description = "Вкажіть шлях до каталогу товарів";
                        linkedCtrl = this.System_Path_txbox_folderArticles;
                        break;
                    }
                case "System_Path_btn_folderChequesBrowse":
                    {
                        folderBrowserDialog1.Description = "Вкажіть шлях до каталогу чеків";
                        linkedCtrl = this.System_Path_txbox_folderCheques;
                        break;
                    }
                case "System_Path_btn_folderTempBrowse":
                    {
                        folderBrowserDialog1.Description = "Вкажіть шлях до тимчасової папки";
                        linkedCtrl = this.System_Path_txbox_folderTemp;
                        break;
                    }
                case "System_Path_btn_folderBillsBrowse":
                    {
                        folderBrowserDialog1.Description = "Вкажіть шлях до каталогу рахунків";
                        linkedCtrl = this.System_Path_txbox_folderBills;
                        break;
                    }
                case "System_Path_btn_folderUserSchemasBrowse":
                    {
                        folderBrowserDialog1.Description = "Вкажіть шлях до каталогу схем касирів";
                        linkedCtrl = this.System_Path_txbox_folderUserSchemas;
                        break;
                    }
                case "System_Path_btn_folderExchangeBrowse":
                    {
                        folderBrowserDialog1.Description = "Вкажіть шлях до каталогу обміну";
                        linkedCtrl = this.System_Path_txbox_folderExchange;
                        break;
                    }
                case "System_Path_btn_folderUsersBrowse":
                    {
                        folderBrowserDialog1.Description = "Вкажіть шлях до каталогу користувачів";
                        linkedCtrl = this.System_Path_txbox_folderUsers;
                        break;
                    }
                case "System_Path_btn_folderTemplatesBrowse":
                    {
                        folderBrowserDialog1.Description = "Вкажіть шлях до каталогу шаблонів";
                        linkedCtrl = this.System_Path_txbox_folderTemplates;
                        break;
                    }
                case "System_Path_btn_folderPluginsBrowse":
                    {
                        folderBrowserDialog1.Description = "Вкажіть шлях до каталогу додатків";
                        linkedCtrl = this.System_Path_txbox_folderPlugins;
                        break;
                    }
                case "System_Path_btn_folderReportsBrowse":
                    {
                        folderBrowserDialog1.Description = "Вкажіть шлях до каталогу звітів";
                        linkedCtrl = this.System_Path_txbox_folderReports;
                        break;
                    }
                    // Profiles
                case "profiles_btn_create":
                    {
                        TabPage tp = new TabPage();
                        tp.ImageIndex = 0;
                        wndSettings.uc_firmEntry fe = new wndSettings.uc_firmEntry();
                        fe.BackColor = Color.White;
                        fe.Dock = DockStyle.Fill;
                        tp.Controls.Add(fe);
                        profiles_tab_profiles.TabPages.Add(tp);
                        profiles_tab_profiles.SelectedTab = tp;

                        profiles_tab_profiles.Visible = !(profiles_tab_profiles.TabPages.Count == 0);
                        break;
                    }
                case "profiles_btn_refresh":
                    {
                        Hashtable profiles = new Hashtable();
                        BindingSource bs = new BindingSource();

                        for (int i = 0; i < profiles_tab_profiles.TabPages.Count; i++)
                        {
                            wndSettings.uc_firmEntry fe = (wndSettings.uc_firmEntry)profiles_tab_profiles.TabPages[i].Controls[0];
                            profiles[fe.Profile_ID] = fe.Profile_Name;
                        }

                        profiles[CoreConst.KEY_DEFAULT_PROFILE_ID] = "-";
                        bs.DataSource = profiles;
                        this.profiles_cBox_legalProfile.DataSource = bs;
                        this.profiles_cBox_legalProfile.DisplayMember = "Value";

                        break;
                    }
                case "tax_profiles_btn_refresh":
                    {
                        Hashtable profiles = new Hashtable();
                        BindingSource bs = new BindingSource();

                        for (int i = 0; i < profiles_tab_profiles.TabPages.Count; i++)
                        {
                            wndSettings.uc_firmEntry fe = (wndSettings.uc_firmEntry)profiles_tab_profiles.TabPages[i].Controls[0];
                            profiles[fe.Profile_ID] = fe.Profile_Name;
                        }

                        profiles[CoreConst.KEY_DEFAULT_PROFILE_ID] = "-";
                        bs.DataSource = profiles;
                        this.tax_profile_cBox.DataSource = bs;
                        this.tax_profile_cBox.DisplayMember = "Value";

                        break;
                    }
                case "tax_profile_btnSave":
                    {
                        //object pId = this.tax_profile_cBox.SelectedValue;

                        string pk = CoreConst.KEY_DEFAULT_PROFILE_ID;
                        try
                        {
                            pk = ((DictionaryEntry)tax_profile_cBox.SelectedItem).Key.ToString();
                        }
                        catch { }

                        Settings_Tax_Grid_Save(pk);

                        /*
                        Hashtable compatibleTaxGrid = ConfigManager.Instance.CommonConfiguration.TAX_Compatibility_Template;
                        Hashtable userTaxDefined = new Hashtable();

                        // fill tax compatibility with selected values
                        for (int i = 0; i < dataGridView_tax_compatibility.RowCount; i++)
                            compatibleTaxGrid[dataGridView_tax_compatibility["mkt", i].Value] = dataGridView_tax_compatibility["pd", i].Value;

                        // user defined tax
                        for (int i = 0; i < dataGridView_tax_userdefined.RowCount; i++)
                            userTaxDefined[dataGridView_tax_userdefined["taxChar", i].Value] = string.Format("{0};{1}", dataGridView_tax_userdefined["taxRate",i].Value, dataGridView_tax_userdefined["taxDisc",i].Value);

                        // saving
                        ConfigManager.Instance.CommonConfiguration.TAX_Compatibility[pId] = compatibleTaxGrid;

                        */

                        break;
                    }
            }

            try
            {
                folderBrowserDialog1.SelectedPath = ((TextBox)linkedCtrl).Text;
                folderBrowserDialog1.ShowDialog();
                ((TextBox)linkedCtrl).Text = folderBrowserDialog1.SelectedPath;
            }
            catch { }
        }