示例#1
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();
            }
        }
示例#2
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();
            }
        }
示例#3
0
        private void LoadUpdateStaff()
        {
            try
            {
                SQLConn.sqL = "SELECT * FROM cash_account WHERE AccountID = '" + StaffID + "'";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    lblNo.Text      = SQLConn.dr["AccountID"].ToString();
                    txt_Name.Text   = SQLConn.dr["AccountName"].ToString();
                    txt_waist.Text  = SQLConn.dr["Waist"].ToString();
                    txt_labour.Text = SQLConn.dr["Labour"].ToString();
                    txRati.Text     = SQLConn.dr["Rati"].ToString();
                    txDesc.Text     = SQLConn.dr["Description"].ToString();
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
示例#4
0
        private void GetStaffID()
        {
            try
            {
                SQLConn.sqL = "SELECT AccountID FROM cash_account ORDER BY AccountID DESC";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    lblNo.Text = (Convert.ToInt32(SQLConn.dr["AccountID"]) + 1).ToString();
                }
                else
                {
                    lblNo.Text = "1";
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
示例#5
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);
        }
示例#6
0
        public void LoadStaffs(String search)
        {
            try
            {
                SQLConn.sqL = "SELECT AccountID, AccountName,Waist,Labour,Description,Rati FROM cash_account WHERE AccountName 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["AccountName"].ToString());
                    x.SubItems.Add(SQLConn.dr["Description"].ToString());
                    x.SubItems.Add(SQLConn.dr["Waist"].ToString());
                    x.SubItems.Add(SQLConn.dr["Labour"].ToString());
                    x.SubItems.Add(SQLConn.dr["Rati"].ToString());

                    ListView1.Items.Add(x);
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.Message);
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
示例#7
0
        void call_balance()
        {
            try
            {
                SQLConn.sqL = "SELECT Balance FROM casting ORDER BY id DESC";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    if (dec_spe == true)
                    {
                        textBox1.Text = Strings.Format(SQLConn.dr["Balance"], "#,###0.000");
                    }
                    else
                    {
                        ds            = Strings.Format(SQLConn.dr["Balance"], "#,###0.000");
                        d             = Convert.ToDecimal(ds);
                        d             = decimal.Round(d, 2, MidpointRounding.AwayFromZero); //2.58
                        textBox1.Text = d.ToString() + "0";
                    }
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
示例#8
0
        private void LoadReport()
        {
            try
            {
                if (find == "")
                {
                    SQLConn.sqL = "SELECT TDetailNo,CONCAT(Firstname, ' ', Lastname)as Name,ad.AccountID,SerialNo,ad.DateIN,TimeIN,Rati,ad.Labour,L_Money_In_Debt,Total_Money,CurrentGivenMoney,Total_Money_In_Debt,Casting,ad.Waist,Total_Casting,Impurity,PureGold,AdvanceGivenGold,Subtotal_Gold,L_Gold_In_Debt,Total_Gold,CurrentGivenGold,Total_Gold_In_Debt from accountdetails as ad,accounts as a where ad.AccountID=a.AccountID AND DATE_FORMAT(STR_TO_DATE(ad.DateIN, '%m-%d-%Y'), '%Y-%m-%d') BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + EndDate.ToString("yyyy-MM-dd") + "'   GROUP BY TDetailNo,ad.AccountID ORDER BY ad.DateIN";
                }
                else
                {
                    SQLConn.sqL = "SELECT TDetailNo,CONCAT(Firstname, ' ', Lastname)as Name,ad.AccountID,SerialNo,ad.DateIN,TimeIN,Rati,ad.Labour,L_Money_In_Debt,Total_Money,CurrentGivenMoney,Total_Money_In_Debt,Casting,ad.Waist,Total_Casting,Impurity,PureGold,AdvanceGivenGold,Subtotal_Gold,L_Gold_In_Debt,Total_Gold,CurrentGivenGold,Total_Gold_In_Debt from accountdetails as ad,accounts as a where ad.AccountID='" + find + "' AND ad.AccountID=a.AccountID AND DATE_FORMAT(STR_TO_DATE(ad.DateIN, '%m-%d-%Y'), '%Y-%m-%d') BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + EndDate.ToString("yyyy-MM-dd") + "'   GROUP BY TDetailNo,ad.AccountID ORDER BY ad.DateIN";
                }
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.da  = new MySqlDataAdapter(SQLConn.cmd);

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


                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());
            }
        }
示例#9
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();
            }
        }
示例#10
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();
            }
        }
示例#11
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();
            }
        }
示例#12
0
        private void LoadReport()
        {
            try
            {
                if (find == "")
                {
                    SQLConn.sqL = "SELECT * from debtin  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 * from debtin  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.debtin.Clear();
                SQLConn.da.Fill(this.rahmat_casting_centerDataSet.debtin);


                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());
            }
        }
示例#13
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);
     }
 }
示例#14
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();
            }
        }
示例#15
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();
            }
        }
示例#16
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();
            }
        }
示例#17
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();
            }
        }
示例#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
 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();
     }
 }
示例#20
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();
     }
 }
示例#21
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();
     }
 }
示例#22
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();
     }
 }
示例#23
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();
            }
        }
示例#24
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();
     }
 }
示例#25
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();
     }
 }
示例#26
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();
     }
 }
示例#27
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();
     }
 }
示例#28
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();
            }
        }
示例#29
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);
            }
        }
示例#30
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();
            }
        }