Example #1
0
        private void SaveProperties()
        {
            //Photoland.Security.Properties p = new Photoland.Security.Properties();

            if((checkRemoteSetup.Checked) && (txtRemoteSetupPath.Text != ""))
            {
                PSA.Lib.Util.Semaphore.semRemoteSettings = txtRemoteSetupPath.Text;
            }
            else
            {
                PSA.Lib.Util.Semaphore.semRemoteSettings = "";
            }

            p = new PSA.Lib.Util.Settings();

            if (radioDSN.Checked == true)
            {
                p.Connection_type = "DSN";
                p.Connection_string = "Dsn=" + txtDSN.Text + ";";
            }
            if (radioConnectionString.Checked == true)
            {
                p.Connection_type = "ConnectionString";
                p.Connection_string = "Data Source=" + txtSQLServer.Text + ";Initial Catalog=" + txtSQLBase.Text + ";Persist Security Info=True;User ID=" + txtSQLUser.Text + ";Password="******";";
            }

            p.Db_dsn = txtDSN.Text;
            p.Db_server = txtSQLServer.Text;
            p.Db_user = txtSQLUser.Text;
            p.Db_password = txtSQLPassword.Text;
            p.Db_base = txtSQLBase.Text;

            if (checkRunOneCopyAcceptance.Checked)
                p.Run_one_copy_acceptance = true;
            else
                p.Run_one_copy_acceptance = false;

            if (checkRunOneCopyOperator.Checked)
                p.Run_one_copy_oprator = true;
            else
                p.Run_one_copy_oprator = false;

            if (checkRunOneCopyDesigner.Checked)
                p.Run_one_copy_designer = true;
            else
                p.Run_one_copy_designer = false;

            if (checkRunOneCopyAdmin.Checked)
                p.Run_one_copy_admin = true;
            else
                p.Run_one_copy_admin = false;

            p.Dir_print = txtDirPrint.Text;
            p.Dir_edit = txtDirEdit.Text;
            p.List_of_files = txtListOfFiles.Text;

            if (checkSearchSubDir.Checked)
                p.Search_SubDir = true;
            else
                p.Search_SubDir = false;

            p.Dir_rescan = int.Parse(txtDirRescan.Text);

            p.Time_for_output = int.Parse(txtTimeForOutput.Text);
            p.Time_begin_work = int.Parse(txtBeginWork.Text);
            p.Time_end_work = int.Parse(txtEndWork.Text);
            p.Order_prefics = txtOrderPrifics.Text;

            p.Qbtn01_id = lblQbtn1_id.Text;
            p.Qbtn02_id = lblQbtn2_id.Text;
            p.Qbtn03_id = lblQbtn3_id.Text;
            p.Qbtn04_id = lblQbtn4_id.Text;
            p.Qbtn05_id = lblQbtn5_id.Text;
            p.Qbtn06_id = lblQbtn6_id.Text;
            p.Qbtn07_id = lblQbtn7_id.Text;
            p.Qbtn08_id = lblQbtn8_id.Text;
            p.Qbtn09_id = lblQbtn9_id.Text;
            p.Qbtn10_id = lblQbtn10_id.Text;

            p.Qbtn01_text = txtQbtn1_string.Text;
            p.Qbtn02_text = txtQbtn2_string.Text;
            p.Qbtn03_text = txtQbtn3_string.Text;
            p.Qbtn04_text = txtQbtn4_string.Text;
            p.Qbtn05_text = txtQbtn5_string.Text;
            p.Qbtn06_text = txtQbtn6_string.Text;
            p.Qbtn07_text = txtQbtn7_string.Text;
            p.Qbtn08_text = txtQbtn8_string.Text;
            p.Qbtn09_text = txtQbtn9_string.Text;
            p.Qbtn10_text = txtQbtn10_string.Text;

            p.Qbtn01_stext = lblqbnts1.Text;
            p.Qbtn02_stext = lblqbnts2.Text;
            p.Qbtn03_stext = lblqbnts3.Text;
            p.Qbtn04_stext = lblqbnts4.Text;
            p.Qbtn05_stext = lblqbnts5.Text;
            p.Qbtn06_stext = lblqbnts6.Text;
            p.Qbtn07_stext = lblqbnts7.Text;
            p.Qbtn08_stext = lblqbnts8.Text;
            p.Qbtn09_stext = lblqbnts9.Text;
            p.Qbtn10_stext = lblqbnts10.Text;

            p.UpdatePaymentTable = int.Parse(txtUpdateTablePayment.Text);
            p.UpdateOrderTableInAcceptance = int.Parse(txtUpdateOrderTableInAcceptance.Text);

            p.PathReportsTemplates = txtReportFile.Text;

            if (checkColorRowsInOrderTable.Checked)
                p.Color_rows_in_order = true;
            else
                p.Color_rows_in_order = false;

            if (checkFlyWindowOperator.Checked)
                p.Fly_window_operator = true;
            else
                p.Fly_window_operator = false;

            if (checkModOperatorTopMost.Checked)
                p.Mod_operator_top_most = true;
            else
                p.Mod_operator_top_most = false;

            p.UpdateOrderTableInOperator = int.Parse(txtOrderListOperatorUpdate.Text);

            if (checkFlyWindowDesigner.Checked)
                p.Fly_window_designer = true;
            else
                p.Fly_window_designer = false;

            if (checkModDesignerTopMost.Checked)
                p.Mod_designer_top_most = true;
            else
                p.Mod_designer_top_most = false;

            p.UpdateOrderTableInDesigner = int.Parse(txtOrderListDesignerUpdate.Text);

            p.Dir_import = txtImport.Text;
            p.Dir_export = txtExport.Text;
            p.Dir_net_export = txtExportNet.Text;

            if (checkRobotIconAnimation.Checked)
                p.Robot_animation_icon = true;
            else
                p.Robot_animation_icon = false;

            if (checkRunOneCopyRobot.Checked)
                p.Run_one_copy_robot = true;
            else
                p.Run_one_copy_robot = false;

            p.SQL_Import_Template_DCard = txtSQLTemplateDCard.Text;
            p.SQL_Import_Template_Good = txtSQLTemplateGood.Text;
            p.SQL_Import_Template_Mashine = txtSQLTemplateMashine.Text;
            p.SQL_Import_Template_Material = txtSQLTemplateMaterial.Text;
            p.ReklamBlock1 = txtReklamBlock1.Text;

            if (checkCheckPreview.Checked)
                p.CheckPreview = true;
            else
                p.CheckPreview = false;

            p.CheckCount = int.Parse(txtCheckCount.Text);

            p.PasswordClass1 = txtPasswordClass1.Text;

            if (checkAutoSendCrashReport.Checked)
                p.AutoSendCrashReport = true;
            else
                p.AutoSendCrashReport = false;

            if (checkSMTPAut.Checked)
                p.SMTPAut = true;
            else
                p.SMTPAut = false;

            p.SMTPPasswordFrom = txtSMTPPassword.Text;
            p.SMTPServer = txtSMTPServer.Text;
            p.SMTPUserFrom = txtSMTPName.Text;
            p.SMTPUserFromEmail = txtSMTPFromEmail.Text;
            p.SMTPUserTo = txtSMTPToEmail.Text;

            p.FTP_Server = txtFTPServer.Text;
            p.FTP_Path = txtFTPPath.Text;
            p.FTP_User = txtFTPUser.Text;
            p.FTP_Password = txtFTPPassword.Text;
            p.FTP_Path_Export = txtFTPPathExport.Text;
            p.FTP_Server_Export = txtFTPServerExport.Text;
            p.Import_time = int.Parse(txtTimeImport.Text);
            p.Export_time = int.Parse(txtTimeExport.Text);

            if (checkFtpImport.Checked)
                p.Import_from_ftp = true;
            else
                p.Import_from_ftp = false;

            if (checkExportFP.Checked)
                p.Export_from_ftp = true;
            else
                p.Export_from_ftp = false;

            if (checkUseShortListGoods.Checked)
                p.ShortGoodsListInWizard = true;
            else
                p.ShortGoodsListInWizard = false;

            if (checkExportDoCopy.Checked)
                p.ExportDoCopy = true;
            else
                p.ExportDoCopy = false;

            if (checkClearAfterCopy.Checked)
                p.ExportClearDirAfterCopy = true;
            else
                p.ExportClearDirAfterCopy = false;

            p.ModelRound = int.Parse(txtSumRound.SelectedValue.ToString());

            if (checkQueryDelete.Checked)
                p.QueryForDelete = true;
            else
                p.QueryForDelete = false;

            if (checkDenyDelete.Checked)
                p.DenyDelete = true;
            else
                p.DenyDelete = false;

            if (checkExportOld.Checked)
                p.ExportOld = true;
            else
                p.ExportOld = false;

            p.DCard_limit = int.Parse(txtDCardLimit.Text);
            p.PublicIni = txtPublicIni.Text;

            if (checkRunOneInventory.Checked)
                p.Run_one_copy_inventory = true;
            else
                p.Run_one_copy_inventory = false;

            p.Order_terminal_prefics = txtPrefixTerminal.Text;

            p.SemaphoreInventory = checkInventory.Checked;

            p.Dir_tmp_export = txtDirTmpExport.Text;
            p.Round3 = checkRound3.Checked;
            p.Terminal_client_one = checkTerminalClientOne.Checked;
            p.Terminal_print_check = checkTerminalPrintCheck.Checked;
            p.Terminal_control_worker = checkTerminalControlWorker.Checked;
            p.UseXmlCache = checkUseXmlCache.Checked;
            p.LoadNotApproved = checkLoadNotApproved.Checked;
            p.Load1000 = checkLoad1000.Checked;
            p.ShowQuickOrder = checkShowQuickOrder.Checked;
            p.DiscontServerAddress = txtDiscontServerAddress.Text;
            p.CheckString1 = txtCheckText1.Text;
            p.CheckString2 = txtCheckText2.Text;
            p.ShowMFoto = checkMFoto.Checked;
            p.MfotoAlbumsPath = txtDirMfoto.Text;

            p.ExportOld = checkExportOld.Checked;
            p.DontLockExported = checkDontLockExport.Checked;

            p.PublicKey = txtPublicKey.Text;
            p.PrivateKey = txtPrivateKey.Text;
            p.ApiRequestToken = txtApiRequestToken.Text;
            p.ApiAccessToken = txtApiAccessToken.Text;
            p.ApiOrder = txtApiOrder.Text;
            p.ApiOrderItems = txtApiOrderItems.Text;
            p.ApiProducts = txtApiProducts.Text;
            p.OrderPixlPark = txtOrderPixlPark.Text;

            p.Dir_auto_import = txtDirAutoImport.Text;
            p.ApiUser = txtApiUser.Text;
            p.AStatus = txtAStatus.Text;
            p.OStatus = txtOStatus.Text;
            p.DStatus = txtDStatus.Text;
            p.PrintAfterImport = checkPrintAfterImport.Checked;
            p.SelectImport = checkSelectImport.Checked;
            p.PixlParkClient = checkPixlParkClient.Checked;
            p.EmailDayReport = txtEmailDayReport.Text;
            p.EmailDayFrom = txtEmailDayFrom.Text;
            p.EmailDayAuth = txtEmailDayAuth.Text;
            p.EmailDayPas = txtEmailDayPas.Text;
            p.EmailDayHost = txtEmailDayHost.Text;
            p.EmailDayPort = int.Parse(txtEmailDayPort.Text);

            if(!p.Save())
                MessageBox.Show("Ошибка при сохранении настроек!", "Настройки программы", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }