Пример #1
0
        private bool IsAdding()
        {
            bool ret = false;

            try
            {
                SQLConn.sqL = "SELECT * FROM setting";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();
                if (SQLConn.dr.Read() == true)
                {
                    ret = false;
                }
                else
                {
                    ret = true;
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
            return(ret);
        }
Пример #2
0
        public void GetMessage()
        {
            try
            {
                SQLConn.sqL = "SELECT msg FROM setting";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();


                if (SQLConn.dr.Read())
                {
                    label25.Text = SQLConn.dr[0].ToString();
                }
                else
                {
                    label25.Text = "";
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #3
0
        private void LoadReport()
        {
            try
            {
                if (find == "")
                {
                    SQLConn.sqL = "SELECT TDetailNo, AccountID,Name,SerialNo,DateIN,TimeIN,GoldRate,GoldPrice,Rati,Labour,L_Money_In_Debt,Total_Money,CurrentGivenMoney,Total_Money_In_Debt,Casting,Waist,Total_Casting,Impurity,PureGold,AdvanceGivenGold,Subtotal_Gold,L_Gold_In_Debt,Total_Gold,CurrentGivenGold,Total_Gold_In_Debt from caccountdetails where  DATE_FORMAT(STR_TO_DATE(DateIN, '%m-%d-%Y'), '%Y-%m-%d') BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + EndDate.ToString("yyyy-MM-dd") + "'   GROUP BY TDetailNo,AccountID ORDER BY DateIN";
                }
                else
                {
                    SQLConn.sqL = "SELECT TDetailNo, AccountID,Name,SerialNo,DateIN,TimeIN,GoldRate,GoldPrice,Rati,Labour,L_Money_In_Debt,Total_Money,CurrentGivenMoney,Total_Money_In_Debt,Casting,Waist,Total_Casting,Impurity,PureGold,AdvanceGivenGold,Subtotal_Gold,L_Gold_In_Debt,Total_Gold,CurrentGivenGold,Total_Gold_In_Debt from caccountdetails where AccountID='" + find + "' AND DATE_FORMAT(STR_TO_DATE(DateIN, '%m-%d-%Y'), '%Y-%m-%d') BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + EndDate.ToString("yyyy-MM-dd") + "'   GROUP BY TDetailNo,AccountID ORDER BY DateIN";
                }
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.da  = new MySqlDataAdapter(SQLConn.cmd);

                this.rahmat_casting_centerDataSet.caccountdetails.Clear();
                SQLConn.da.Fill(this.rahmat_casting_centerDataSet.caccountdetails);


                ReportParameter startDate = new ReportParameter("StartDate", StartDate.ToString());
                ReportParameter endDate   = new ReportParameter("EndDate", EndDate.ToString());
                this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { startDate, endDate });

                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
        }
Пример #4
0
        private void cmdTest_Click(object sender, EventArgs e)
        {
            //Test database connection

            TstServerMySQL   = txtServerHost.Text;
            TstPortMySQL     = txtPort.Text;
            TstUserNameMySQL = txtUserName.Text;
            TstPwdMySQL      = txtPassword.Text;
            TstDBNameMySQL   = txtDatabase.Text;


            try
            {
                SQLConn.conn.ConnectionString = "Server = '" + TstServerMySQL + "';  " + "Port = '" + TstPortMySQL + "'; " + "Database = '" + TstDBNameMySQL + "'; " + "user id = '" + TstUserNameMySQL + "'; " + "password = '******'";


                SQLConn.conn.Open();
                Interaction.MsgBox("Test connection successful", MsgBoxStyle.Information, "Database Settings");
            }
            catch
            {
                Interaction.MsgBox("The system failed to establish a connection", MsgBoxStyle.Information, "Database Settings");
            }
            SQLConn.DisconnMy();
        }
Пример #5
0
        public void GetCompanyInfo()
        {
            try
            {
                SQLConn.sqL = "SELECT Gold_Rate,digit,msg FROM setting";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();


                if (SQLConn.dr.Read())
                {
                    textBox2.Text = SQLConn.dr[0].ToString();

                    if (SQLConn.dr[1].ToString() == "true")
                    {
                        checkBox1.Checked = true;
                    }
                    else
                    {
                        checkBox1.Checked = false;
                    }
                    textBox1.Text = SQLConn.dr[2].ToString();
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #6
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            TstServerMySQL   = txtServerHost.Text;
            TstPortMySQL     = txtPort.Text;
            TstUserNameMySQL = txtUserName.Text;
            TstPwdMySQL      = txtPassword.Text;
            TstDBNameMySQL   = txtDatabase.Text;

            try
            {
                SQLConn.conn.ConnectionString = "Server = '" + TstServerMySQL + "';  " + "Port = '" + TstPortMySQL + "'; " + "Database = '" + TstDBNameMySQL + "'; " + "user id = '" + TstUserNameMySQL + "'; " + "password = '******'";
                SQLConn.conn.Open();

                SQLConn.DBNameMySQL   = txtDatabase.Text;
                SQLConn.ServerMySQL   = txtServerHost.Text;
                SQLConn.UserNameMySQL = txtUserName.Text;
                SQLConn.PortMySQL     = txtPort.Text;
                SQLConn.PwdMySQL      = txtPassword.Text;

                SQLConn.SaveData();
                this.Close();
            }
            catch
            {
                Interaction.MsgBox("The system failed to establish a connection", MsgBoxStyle.Information, "Database Settings");
            }
            SQLConn.DisconnMy();
            //save database
        }
Пример #7
0
 private void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog theDialog = new OpenFileDialog();
         theDialog.Title  = "Open Text File";
         theDialog.Filter = "BackUp File (*.sql)|*.sql";
         if (theDialog.ShowDialog() == DialogResult.OK)
         {
             string file = Path.GetFullPath(theDialog.FileName);
             SQLConn.ConnDB();
             SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
             MySqlBackup mb = new MySqlBackup(SQLConn.cmd);
             mb.ImportInfo.TargetDatabase         = "rahmat_casting_center";
             mb.ImportInfo.DatabaseDefaultCharSet = "utf8";
             mb.ImportFromFile(file);
             LoadStaffs("");
             MessageBox.Show("Restoring Successfully Completed.");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Restroring UnSuccessfull. " + ex);
     }
 }
Пример #8
0
        void  load_gold()
        {
            try
            {
                SQLConn.sqL = "select *  FROM setting";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();



                if (SQLConn.dr.Read() == true)
                {
                    //Without Decimal Money , Labour
                    textBox2.Text = SQLConn.dr["Gold_Rate"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error :" + ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #9
0
        private void checkSerialCash()
        {
            try
            {
                SQLConn.sqL = "SELECT SerialNo FROM caccountdetails where AccountID='" + textBox1.Text + "' ORDER BY SerialNo DESC";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    label22.Text = (Convert.ToInt32(SQLConn.dr["SerialNo"]) + 1).ToString();
                }
                else
                {
                    label22.Text = "1";
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #10
0
        private void LoadReport()
        {
            try
            {
                if (find == "")
                {
                    SQLConn.sqL = "SELECT TDetailNo, AccountID,Name,SerialNo,DateIN,TimeIN,image,image1 from caccountdetails where DATE_FORMAT(STR_TO_DATE(DateIN, '%m-%d-%Y'), '%Y-%m-%d') BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + EndDate.ToString("yyyy-MM-dd") + "'   GROUP BY TDetailNo,AccountID ORDER BY DateIN";
                }
                else
                {
                    SQLConn.sqL = "SELECT TDetailNo, AccountID,Name,SerialNo,DateIN,TimeIN,image,image1 from caccountdetails where AccountId='" + find + "' AND DATE_FORMAT(STR_TO_DATE(DateIN, '%m-%d-%Y'), '%Y-%m-%d') BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + EndDate.ToString("yyyy-MM-dd") + "'   GROUP BY TDetailNo,AccountID ORDER BY DateIN";
                }
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.da  = new MySqlDataAdapter(SQLConn.cmd);



                this.rahmat_casting_centerDataSet.caccountdetails.Clear();
                SQLConn.da.Fill(this.rahmat_casting_centerDataSet.caccountdetails);

                ReportParameter startDate = new ReportParameter("StartDate", StartDate.ToString());
                ReportParameter endDate   = new ReportParameter("EndDate", EndDate.ToString());
                this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { startDate, endDate });



                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
        }
Пример #11
0
        void check_decimal_func()
        {
            try
            {
                SQLConn.sqL = "SELECT digit FROM setting";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();


                if (SQLConn.dr.Read())
                {
                    if (SQLConn.dr["digit"].ToString() == "true")
                    {
                        dec_spe = true;
                    }
                    else
                    {
                        dec_spe = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #12
0
        public void AddEditCompany(bool isAdding)
        {
            try
            {
                if (isAdding == true)
                {
                    SQLConn.sqL = "INSERT INTO setting(id, Gold_Rate,digit,msg) VALUES(@id, @Gold_Rate,@digit,@msg)";
                }
                else
                {
                    SQLConn.sqL = "UPDATE setting SET id=@id, Gold_Rate=@Gold_Rate, digit =@digit,msg=@msg";
                }
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);

                SQLConn.cmd.Parameters.AddWithValue("@id", "1");

                SQLConn.cmd.Parameters.AddWithValue("@Gold_Rate", textBox2.Text);
                SQLConn.cmd.Parameters.AddWithValue("@msg", textBox1.Text);

                if (checkBox1.Checked == true)
                {
                    SQLConn.cmd.Parameters.AddWithValue("@digit", "true");
                }
                else
                {
                    SQLConn.cmd.Parameters.AddWithValue("@digit", "false");
                }


                int i = SQLConn.cmd.ExecuteNonQuery();
                if (i > 0)
                {
                    if (isAdding == true)
                    {
                        //   Interaction.MsgBox("Information Successfully Added", MsgBoxStyle.Information, "Adding Information");
                    }
                    else
                    {
                        //   Interaction.MsgBox("Information Successfully Updated", MsgBoxStyle.Information, "Editing Information");
                    }
                }
                else
                {
                    Interaction.MsgBox("Saving Information Failed", MsgBoxStyle.Exclamation, "Failed");
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #13
0
        private void LoadUpdateStaff()
        {
            check_decimal_func();
            txt_gold.ReadOnly  = true;
            txt_money.ReadOnly = true;

            try
            {
                SQLConn.sqL = "SELECT * FROM ACCOUNTS WHERE AccountID = '" + LSAccountID + "'";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    lblAccountNo.Text = SQLConn.dr["AccountID"].ToString();
                    txtFirstname.Text = SQLConn.dr["Firstname"].ToString();
                    txtLastname.Text  = SQLConn.dr["lastname"].ToString();



                    txtArea.Text       = SQLConn.dr["Area"].ToString();
                    txtCity.Text       = SQLConn.dr["City"].ToString();
                    txtShopNo.Text     = SQLConn.dr["ShopNo"].ToString();
                    txtContractNo.Text = SQLConn.dr["ContactNo"].ToString();
                    if (dec_spe == true)
                    {
                        txt_gold.Text = Strings.Format(SQLConn.dr["Gold_Debt"], "#,###0.000");
                    }
                    else
                    {
                        String  ds = "";
                        decimal d  = 0;
                        ds            = Strings.Format(Strings.Format(SQLConn.dr["Gold_Debt"], "#,###0.000"));
                        d             = Convert.ToDecimal(ds);
                        d             = decimal.Round(d, 2, MidpointRounding.AwayFromZero); //2.58
                        txt_gold.Text = d.ToString() + "0";
                    }

                    txt_money.Text  = SQLConn.dr["Money_Debt"].ToString();
                    txt_waist.Text  = SQLConn.dr["Waist"].ToString();
                    txt_labour.Text = SQLConn.dr["Labour"].ToString();
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #14
0
        void loadAccount(String accountID)
        {
            try
            {
                SQLConn.sqL = "select *  FROM accounts where AccountID='" + accountID + "'";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();



                if (SQLConn.dr.Read() == true)
                {
                    //Without Decimal Money , Labour
                    labour        = Convert.ToInt32(SQLConn.dr["Labour"]);
                    textBox6.Text = SQLConn.dr["Money_Debt"].ToString();

                    // With Decimals Gold , Waist
                    waist = Strings.Format(SQLConn.dr["Waist"], "#,###0.000");
                    if (dec_spe == true)
                    {
                        textBox10.Text = Strings.Format(SQLConn.dr["Gold_Debt"], "#,###0.000");
                    }
                    else
                    {
                        ds             = Strings.Format(SQLConn.dr["Gold_Debt"], "#,###0.000");
                        d              = Convert.ToDecimal(ds);
                        d              = decimal.Round(d, 2, MidpointRounding.AwayFromZero); //2.58
                        textBox10.Text = d.ToString() + "0";
                    }
                    String f_name    = SQLConn.dr["Firstname"].ToString();
                    String l_name    = SQLConn.dr["Lastname"].ToString();
                    String full_name = f_name + " " + l_name;
                    textBox23.Text = full_name;
                    textBox7.Text  = Strings.Format(Conversion.Val(textBox5.Text) + Conversion.Val(textBox6.Text));
                    checkSerial();
                    textBox3.Focus();
                }
                else
                {
                    SystemSounds.Beep.Play();
                    textBox1.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error :" + ex);
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #15
0
        public void LoadStaffs(String search)
        {
            try
            {
                SQLConn.sqL = "SELECT AccountID, CONCAT( Firstname,' ',Lastname,  ' ') as ClientName, CONCAT( Area, ', ', City) as Address, ContactNo,ShopNo,Gold_Debt,Money_Debt,DateIN FROM accounts WHERE AccountID LIKE '" + search.Trim() + "%' ORDER By AccountID";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                ListViewItem x = null;
                ListView1.Items.Clear();

                while (SQLConn.dr.Read() == true)
                {
                    x = new ListViewItem(SQLConn.dr["AccountId"].ToString());
                    x.SubItems.Add(SQLConn.dr["ClientName"].ToString());
                    if (dec_spe == true)
                    {
                        x.SubItems.Add(Strings.Format(SQLConn.dr["Gold_Debt"], "#,###0.000"));
                    }
                    else
                    {
                        String  ds = "";
                        decimal d  = 0;
                        ds = Strings.Format(Strings.Format(SQLConn.dr["Gold_Debt"], "#,###0.000"));
                        d  = Convert.ToDecimal(ds);
                        d  = decimal.Round(d, 2, MidpointRounding.AwayFromZero); //2.58
                        x.SubItems.Add(d.ToString() + "0");
                    }
                    x.SubItems.Add(SQLConn.dr["Money_debt"].ToString());
                    x.SubItems.Add(SQLConn.dr["ContactNo"].ToString());
                    x.SubItems.Add(SQLConn.dr["Address"].ToString());
                    x.SubItems.Add(SQLConn.dr["ShopNo"].ToString());
                    x.SubItems.Add(SQLConn.dr["DateIN"].ToString());


                    ListView1.Items.Add(x);
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.Message);
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #16
0
 private void AddAccounts(int account, String first, String last, int contact, int shop, double waist, int labour, String area, String city, double gold, int money, String date)
 {
     try
     {
         SQLConn.sqL = "INSERT INTO ACCOUNTS( AccountID,Firstname,Lastname, ContactNo,ShopNo, Waist, Labour, Area, City, Gold_Debt,Money_Debt,DateIN ) VALUES( '" + account + "','" + first + "', '" + last + "', '" + contact + "', '" + shop + "', '" + waist + "', '" + labour + "', '" + area + "', '" + city + "', '" + gold + "', '" + money + "', '" + date + "')";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Пример #17
0
 public void insert_account()
 {
     try
     {
         SQLConn.sqL = "UPDATE accounts SET Gold_Debt='" + textBox20.Text + "',Money_Debt='" + textBox9.Text + "',DateIN='" + System.DateTime.Now.ToString("MM-dd-yyyy") + "' where AccountID='" + textBox1.Text + "'";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Пример #18
0
 public void insert_accountdetails()
 {
     try
     {
         SQLConn.sqL = "INSERT INTO accountdetails(AccountID,SerialNo,DateIN,TimeIN,Rati,Labour,L_Money_In_Debt,Total_Money,CurrentGivenMoney,Total_Money_In_Debt,Casting,Waist,Total_Casting,Impurity,PureGold,AdvanceGivenGold,Subtotal_Gold,L_Gold_In_Debt,Total_Gold,CurrentGivenGold,Total_Gold_In_Debt) VALUES('" + textBox1.Text + "','" + label22.Text + "', '" + System.DateTime.Now.ToString("MM-dd-yyyy") + "', '" + System.DateTime.Now.ToString("hh:mm") + "' ,'" + textBox3.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox17.Text + "','" + textBox16.Text + "','" + textBox15.Text + "','" + textBox14.Text + "','" + textBox13.Text + "','" + textBox12.Text + "','" + textBox11.Text + "','" + textBox10.Text + "','" + textBox22.Text + "','" + textBox21.Text + "','" + textBox20.Text + "')";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Пример #19
0
 private void UpdateAccountDebt()
 {
     try
     {
         SQLConn.sqL = "UPDATE accounts SET DateIN='" + System.DateTime.Now.ToString("MM-dd-yyyy") + "',Gold_Debt =  '" + txtTotalGoldDebt.Text + "',Money_Debt =  '" + txtTotalMoneyDebt.Text + "' WHERE AccountID = '" + accountID + "'";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Пример #20
0
 public void insert_casting()
 {
     try
     {
         SQLConn.sqL = "INSERT INTO casting(DateIN,CurrentCasting,CastingCame,SaleCasting,Balance) VALUES('" + dtpStartDate.Value.ToString("MM-dd-yyyy") + "','" + textBox1.Text + "', '" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Пример #21
0
        private void GetDebtInfo()
        {
            try
            {
                SQLConn.sqL = "SELECT CONCAT(Firstname,' ',Lastname) as name,Gold_Debt,Money_Debt FROM ACCOUNTS WHERE AccountID =" + accountID + "";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    lblName.Text = SQLConn.dr[0].ToString();
                    if (dec_spe == true)
                    {
                        lblGold.Text = Strings.Format(SQLConn.dr[1], "#,###0.000");
                    }
                    else
                    {
                        String  ds = "";
                        decimal d  = 0;
                        ds           = Strings.Format(Strings.Format(SQLConn.dr[1], "#,###0.000"));
                        d            = Convert.ToDecimal(ds);
                        d            = decimal.Round(d, 2, MidpointRounding.AwayFromZero); //2.58
                        lblGold.Text = d.ToString() + "0";
                    }
                    lblMoney.Text = SQLConn.dr[2].ToString();

                    txtGold_Debt.Text = "0.000";

                    txtMoney_Debt.Text = "0";
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #22
0
 private void UpdateStaff()
 {
     try
     {
         SQLConn.sqL = "Update cash_account SET  AccountName = '" + txt_Name.Text + "', Waist ='" + txt_waist.Text + "', Labour = '" + txt_labour.Text + "', Rati= '" + txRati.Text + "', Description= '" + txDesc.Text + "' WHERE AccountID = '" + StaffID + "'";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
         //     Interaction.MsgBox("Cash Account record successfully updated", MsgBoxStyle.Information, "Update Cash Account");
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Пример #23
0
 private void AddStaff()
 {
     try
     {
         SQLConn.sqL = "INSERT INTO cash_account( AccountName, Waist, Labour,Rati,Description) VALUES( '" + txt_Name.Text + "', '" + txt_waist.Text + "', '" + txt_labour.Text + "', '" + txRati.Text + "', '" + txDesc.Text + "')";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
         //   Interaction.MsgBox("New Cash Account successfully added.", MsgBoxStyle.Information, "Add Cash Account");
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Пример #24
0
 private void UpdateStaff()
 {
     try
     {
         SQLConn.sqL = "Update ACCOUNTS SET  Firstname = '" + txtFirstname.Text + "',Lastname = '" + txtLastname.Text + "', Area = '" + txtArea.Text + "', City = '" + txtCity.Text + "', ContactNo = '" + txtContractNo.Text + "', ShopNo = '" + txtShopNo.Text + "', Waist ='" + txt_waist.Text + "', Labour = '" + txt_labour.Text + "', Gold_Debt = '" + txt_gold.Text + "', Money_Debt = '" + txt_money.Text + "' WHERE AccountID = '" + LSAccountID + "'";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
         //  Interaction.MsgBox("Account record successfully updated", MsgBoxStyle.Information, "Update Account");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Пример #25
0
 private void AddStaff()
 {
     try
     {
         SQLConn.sqL = "INSERT INTO ACCOUNTS( Firstname,Lastname, Area, City, ContactNo,ShopNo, Waist, Labour, Gold_Debt,Money_Debt ) VALUES( '" + txtFirstname.Text + "','" + txtLastname.Text + "', '" + txtArea.Text + "', '" + txtCity.Text + "', '" + txtContractNo.Text + "', '" + txtShopNo.Text + "', '" + txt_waist.Text + "', '" + txt_labour.Text + "', '" + txt_gold.Text + "', '" + txt_money.Text + "')";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
         //        Interaction.MsgBox("New Account successfully added.", MsgBoxStyle.Information, "Add Account");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Пример #26
0
        private void AddDebtIn()
        {
            try
            {
                SQLConn.sqL = "INSERT INTO DebtIN(AccountID,Name,LastGoldDebt,LastMoneyDebt,NewGoldDebt,NewMoneyDebt,GivenGold,GivenMoney,DateIn,TimeIN) Values('" + accountID + "', '" + lblName.Text + "', '" + lblGold.Text + "', '" + lblMoney.Text + "', '" + txtTotalGoldDebt.Text + "', '" + txtTotalMoneyDebt.Text + "','" + txtGold_Debt.Text + "','" + txtMoney_Debt.Text + "', '" + System.DateTime.Now.ToString("MM-dd-yyyy") + "','" + System.DateTime.Now.ToString("hh:mm:ss") + "')";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.cmd.ExecuteNonQuery();

                UpdateAccountDebt();
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Пример #27
0
        private void button1_Click(object sender, EventArgs e)
        {
            Stream         myS             = null;
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter           = "BackUp File (*.sql)|*.sql";
            saveFileDialog1.RestoreDirectory = true;
            try
            {
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    if ((myS = saveFileDialog1.OpenFile()) != null)
                    {
                        SQLConn.ConnDB();
                        SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                        MySqlBackup mb   = new MySqlBackup(SQLConn.cmd);
                        string      file = Path.GetFullPath(saveFileDialog1.FileName);
                        myS.Close();


                        mb.ExportInfo.AddCreateDatabase = true;
                        List <string> abc = new List <string>();
                        abc.Add("accountdetails");
                        abc.Add("caccountdetails");
                        abc.Add("casting");
                        abc.Add("debtin");
                        abc.Add("setting");
                        mb.ExportInfo.TablesToBeExportedList = abc;
                        mb.ExportInfo.ExportTableStructure   = true;
                        mb.ExportInfo.ExportRows             = true;
                        mb.ExportToFile(file);
                        MessageBox.Show("BackUp Successfully Completed.");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("BackUp UnSuccessfull. " + ex);
            }
        }
Пример #28
0
        private void Single_Pic()
        {
            if (pictureBox2.Image == null)
            {
                MessageBox.Show("Please Capture an Image first!");
            }
            else
            {
                try
                {
                    SQLConn.sqL = "UPDATE accountdetails SET image= @pic1 ,image1= @pic2 where AccountID='" + acc + "' AND SerialNo='" + ser + "'";
                    SQLConn.ConnDB();
                    SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);

                    MemoryStream stream = new MemoryStream();
                    pictureBox2.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
                    byte[] pic1 = stream.ToArray();

                    MemoryStream stream2 = new MemoryStream();
                    pictureBox4.Image.Save(stream2, System.Drawing.Imaging.ImageFormat.Jpeg);
                    byte[] pic2 = stream2.ToArray();

                    SQLConn.cmd.Parameters.AddWithValue("@pic1", pic1);
                    SQLConn.cmd.Parameters.AddWithValue("@pic2", pic2);

                    SQLConn.cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    Interaction.MsgBox(ex.ToString());
                }
                finally
                {
                    SQLConn.cmd.Dispose();
                    SQLConn.conn.Close();
                }

                callStop();
            }
        }
Пример #29
0
        void load_cashAccount()
        {
            try
            {
                SQLConn.sqL = "select *  FROM cash_account where AccountName='" + textBox1.Text + "'";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();



                if (SQLConn.dr.Read() == true)
                {
                    labour        = Convert.ToInt32(SQLConn.dr["Labour"]);
                    textBox3.Text = SQLConn.dr["Rati"].ToString();
                    waist         = SQLConn.dr["Waist"].ToString();
                    load_gold();
                    checkSerialCash();
                    textBox17.Focus();
                }
                else
                {
                    SystemSounds.Beep.Play();
                    textBox1.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error :" + ex);
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }

            //  textBox7.Text = Strings.Format(Conversion.Val(textBox5.Text) + Conversion.Val(textBox6.Text)+Conversion.Val(textBox4.Text));
        }
Пример #30
0
 void load_chart()
 {
     try
     {
         SQLConn.sqL = "SELECT  * FROM accounts";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.dr  = SQLConn.cmd.ExecuteReader();
         while (SQLConn.dr.Read() == true)
         {
             this.chart1.Series["Money Debt"].Points.AddXY(SQLConn.dr["AccountID"].ToString(), SQLConn.dr["Money_Debt"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }