//check database string
        private void DatabaseSettingConnectButtonClick(object sender, System.Windows.RoutedEventArgs e)
        {
            MySqlNaceassaryElement mysqlNecessaryFunction = new MySqlNaceassaryElement();
            NecessaryFunction      necessaryElement       = new NecessaryFunction();

            this.DatabaseSettingConnectButton.IsEnabled = false;
            if (DatabaseSettingtextboxUsername.Text != string.Empty && DatabaseSettingtextboxPassword.Password != string.Empty && DatabaseSettingtextboxConformPassword.Password != string.Empty && DatabaseSettingtextboxHostIP.Text != string.Empty && DatabaseSettingtextboxPortNumber.Text != string.Empty && DatabaseSettingtextboxPortNumber.Text != string.Empty && DatabaseSettingtextboxDatabaseName.Text != string.Empty && necessaryElement.PasswordIs(DatabaseSettingtextboxPassword.Password, DatabaseSettingtextboxConformPassword.Password))
            {
                if (mysqlNecessaryFunction.ConnectToMysql(this.DatabaseSettingtextboxDatabaseName.Text, this.DatabaseSettingtextboxHostIP.Text, this.DatabaseSettingtextboxPortNumber.Text, this.DatabaseSettingtextboxUsername.Text, this.DatabaseSettingtextboxConformPassword.Password))
                {
                    Properties.Settings.Default.DatabaseServerip       = this.DatabaseSettingtextboxHostIP.Text;
                    Properties.Settings.Default.DatabasePortNumber     = this.DatabaseSettingtextboxPortNumber.Text;
                    Properties.Settings.Default.DarabaseDefultDatabase = this.DatabaseSettingtextboxDatabaseName.Text;
                    Properties.Settings.Default.DatabaseUserName       = this.DatabaseSettingtextboxUsername.Text;
                    Properties.Settings.Default.DatabasePassword       = DatabaseSettingtextboxConformPassword.Password;
                    Properties.Settings.Default.Save();
                    Microsoft.Windows.Controls.MessageBox.Show(ProcestaVariables.Variables.ERROR_MESSAGES[0, 8], ProcestaVariables.Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Information);
                    System.Windows.Forms.Application.Restart();
                    Application.Current.Shutdown();
                }
                else
                {
                    Microsoft.Windows.Controls.MessageBox.Show(ProcestaVariables.Variables.ERROR_MESSAGES[0, 1], ProcestaVariables.Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Error);
                    this.DatabaseSettingConnectButton.IsEnabled = true;
                }
            }
            else
            {
                Microsoft.Windows.Controls.MessageBox.Show(ProcestaVariables.Variables.ERROR_MESSAGES[0, 1] + Environment.NewLine + ProcestaVariables.Variables.ERROR_MESSAGES[0, 7], ProcestaVariables.Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Stop);
                this.DatabaseSettingConnectButton.IsEnabled = true;
            }
        }
Exemple #2
0
        public void ComboBoxItemLoad(DevExpress.Xpf.Editors.ComboBoxEdit devComboBox, string query)
        {
            devComboBox.Items.Clear();
            DataTable tempDataTable = new DataTable();
            MySqlNaceassaryElement mysqlNecessaryFunction = new MySqlNaceassaryElement();

            tempDataTable = mysqlNecessaryFunction.DataReader(query);
            foreach (DataRow comboItems in tempDataTable.Rows)
            {
                devComboBox.Items.Add(comboItems[0]);
            }
        }
        //ProductID Finder
        public string ProductIDFinder(string companyName, string productName, string modelNumber)
        {
            DataTable tempDataTable = new MySqlNaceassaryElement().DataReader(string.Format("SELECT {0} FROM {1} WHERE {2}='{3}' AND {4}='{5}' AND {6}='{7}'", Variables.COLUMN_NAME[4], Variables.TABLE_NAME[11], Variables.COLUMN_NAME[7], companyName, Variables.COLUMN_NAME[10], productName, Variables.COLUMN_NAME[11], modelNumber));

            if (tempDataTable.Rows.Count > 0)
            {
                DataRow productIDDataRow = tempDataTable.Rows[0];
                return((string)productIDDataRow[0]);
            }
            else
            {
                return("");
            }
        }
        //Debtors Creditors Account Info Viewer
        public void DebtorsCreditorsAccountInfoViewer(TextBlock contractPerson, TextBlock phone, TextBlock Email, TextBlock Address, TextBlock Amount, string userID)
        {
            DataTable temDataTable = new MySqlNaceassaryElement().DataReader(string.Format("SELECT * FROM {0},{1} WHERE {0}.{2}='{3}' AND {0}.{2}={1}.{2}", Variables.TABLE_NAME[10], Variables.TABLE_NAME[9], Variables.COLUMN_NAME[3], userID));

            if (temDataTable.Rows.Count > 0)
            {
                DataRow temDataRow = temDataTable.Rows[0];
                contractPerson.Text = temDataRow[4].ToString();
                phone.Text          = temDataRow[2].ToString();
                Email.Text          = temDataRow[3].ToString();
                Address.Text        = temDataRow[5].ToString();
                Amount.Text         = temDataRow[7].ToString();
            }
            temDataTable.Dispose();
        }
        //Sock info Quantity and Rate
        public void StockInfoLoad(TextBlock productID, TextBlock textBlockQuantity, TextBlock textBlockWaitAndAvarageRate, string ProductID)
        {
            DataTable tempDataTable = new MySqlNaceassaryElement().DataReader(string.Format("SELECT * FROM {0} WHERE {1} ='{2}'", Variables.TABLE_NAME[4], Variables.COLUMN_NAME[4], ProductID));

            if (tempDataTable.Rows.Count > 0)
            {
                DataRow tempDataRow = tempDataTable.Rows[0];
                productID.Text                   = Convert.ToString(tempDataRow[0]);
                textBlockQuantity.Text           = Convert.ToString(tempDataRow[1]);
                textBlockWaitAndAvarageRate.Text = Convert.ToString(tempDataRow[2]);
            }
            else
            {
                return;
            }
        }
        //Debtor and Creditors Account Info Loader
        public bool DebtorAndCreditorAccountLoader(TextBlock amount, string userName)
        {
            DataTable tempDataTable = new MySqlNaceassaryElement().DataReader(string.Format("SELECT * FROM {0} WHERE {1}='{2}'", Variables.TABLE_NAME[9], Variables.COLUMN_NAME[3], userName));

            if (tempDataTable.Rows.Count > 0)
            {
                DataRow temDataRow = tempDataTable.Rows[0];
                amount.Text = temDataRow[1].ToString();
                tempDataTable.Dispose();
                return(true);
            }
            else
            {
                tempDataTable.Dispose();
                return(false);
            }
        }
        // Stock info All
        public void StockInfoLoad(TextBlock productID, TextBlock quantity, TextBlock WaitAndAvarageRate, TextBlock Dabit, string ProductIDInternal)
        {
            DataTable tempDataTable = new MySqlNaceassaryElement().DataReader(string.Format("SELECT * FROM {0} WHERE {1} ='{2}'", Variables.TABLE_NAME[4], Variables.COLUMN_NAME[4], ProductIDInternal));

            if (tempDataTable.Rows.Count > 0)
            {
                DataRow tempDataRow = tempDataTable.Rows[0];
                productID.Text          = (string)tempDataRow[0];
                quantity.Text           = (string)(tempDataRow[1]).ToString();
                WaitAndAvarageRate.Text = (string)(tempDataRow[3]).ToString();
                Dabit.Text = (string)(tempDataRow[2]).ToString();
                tempDataTable.Dispose();
            }
            else
            {
                tempDataTable.Dispose();
                return;
            }
        }
 //Stock Info By Group
 public bool StockInfoByGroup(WrapPanel panelStockInfo, string query)
 {
     try
     {
         panelStockInfo.Children.Clear();
         DataTable tempDataTable = new MySqlNaceassaryElement().DataReader(query);
         foreach (DataRow tempDatRow in tempDataTable.Rows)
         {
             StockInfoByGroup tempStockInfoGroup = new StockInfoByGroup();
             tempStockInfoGroup.StockInfoGroupDataContext(tempDatRow);
             panelStockInfo.Children.Add(tempStockInfoGroup);
         }
         tempDataTable.Dispose();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #9
0
 private void strtaupProcess(object sender, ProgressChangedEventArgs e)
 {
     if (e.ProgressPercentage.Equals(1))
     {
         stratupWindowLogingMessages.AnimationArrivalBegin = true;
     }
     else if (e.ProgressPercentage.Equals(2))
     {
         stratupWindowLogingMessages.AnimationLeaveBegin = true;
     }
     else if (e.ProgressPercentage.Equals(3))
     {
         stratupWindowLogingMessages.AnimationArrivalBegin = true;
     }
     else if (e.ProgressPercentage.Equals(4))
     {
         MySqlNaceassaryElement mysqlNecessaryFunction = new MySqlNaceassaryElement();
         MysqlBackupVariablesClass.MYSQL_CONNECTION_STRING[0] = Properties.Settings.Default.DatabaseServerip;
         MysqlBackupVariablesClass.MYSQL_CONNECTION_STRING[1] = Properties.Settings.Default.DatabasePortNumber;
         MysqlBackupVariablesClass.MYSQL_CONNECTION_STRING[2] = Properties.Settings.Default.DarabaseDefultDatabase;
         MysqlBackupVariablesClass.MYSQL_CONNECTION_STRING[3] = Properties.Settings.Default.DatabaseUserName;
         MysqlBackupVariablesClass.MYSQL_CONNECTION_STRING[4] = Properties.Settings.Default.DatabasePassword;
         new MysqlDataBackupRestoreClass().DataBaseRestore("Petunia2.0");
         new Variables().InitializeLoaclData();
         new AccountClass().StartupDataBaseChecker(new DBQueres(mysqlNecessaryFunction.DatabaseOperation), new DatabaseRead(mysqlNecessaryFunction.DataReader), new MysqlRowCounter(mysqlNecessaryFunction.MysqlRowsIs));
     }
     else if (e.ProgressPercentage.Equals(5))
     {
         stratupWindowLogingMessages.AnimationLeaveBegin = true;
     }
     else if (e.ProgressPercentage.Equals(6))
     {
         flagDatabaseError = true;
         Microsoft.Windows.Controls.MessageBox.Show(Variables.ERROR_MESSAGES[0, 1], Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Error);
         new WindowDataBaseSetting().ShowDialog();
         this.Close();
     }
 }
Exemple #10
0
        private void startupWorker(object sender, DoWorkEventArgs e)
        {
            Thread.Sleep(800);
            stratupWindowLogingMessages.AnimationText = "Connecting....";
            stratupBackgroundWorker.ReportProgress(1);
            Thread.Sleep(1000);
            MySqlNaceassaryElement.DatabaseConnectionInfo[0] = Properties.Settings.Default.DatabaseServerip;
            MySqlNaceassaryElement.DatabaseConnectionInfo[1] = Properties.Settings.Default.DatabasePortNumber;
            MySqlNaceassaryElement.DatabaseConnectionInfo[2] = "petunia2.0";
            MySqlNaceassaryElement.DatabaseConnectionInfo[3] = Properties.Settings.Default.DatabaseUserName;
            MySqlNaceassaryElement.DatabaseConnectionInfo[4] = Properties.Settings.Default.DatabasePassword;
            bool databaseConnectionTest;

            try
            {
                databaseConnectionTest = new MySqlNaceassaryElement().ConnectToMysql(Properties.Settings.Default.DarabaseDefultDatabase, Properties.Settings.Default.DatabaseServerip, Properties.Settings.Default.DatabasePortNumber, Properties.Settings.Default.DatabaseUserName, Properties.Settings.Default.DatabasePassword);
            }
            catch
            {
                databaseConnectionTest = false;
            }
            if (databaseConnectionTest)
            {
                stratupBackgroundWorker.ReportProgress(2);
                Thread.Sleep(1000);
                stratupWindowLogingMessages.AnimationText = "Loading....";
                stratupBackgroundWorker.ReportProgress(3);
                Thread.Sleep(2000);
                stratupBackgroundWorker.ReportProgress(4);
                Thread.Sleep(500);
                stratupBackgroundWorker.ReportProgress(5);
                Thread.Sleep(600);
            }
            else
            {
                stratupBackgroundWorker.ReportProgress(6);
            }
        }