Ejemplo n.º 1
0
        private void GetStaffID()
        {
            try
            {
                SQLConn.sqL = "SELECT StaffID FROM STAFF ORDER BY StaffID DESC";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    lblProductNo.Text = (Convert.ToInt32(SQLConn.dr["StaffID"]) + 1).ToString();
                }
                else
                {
                    lblProductNo.Text = "1";
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Ejemplo n.º 2
0
        private void LoadUpdateStaff()
        {
            txt_money.ReadOnly = true;

            try
            {
                SQLConn.sqL = "SELECT * FROM DACCOUNTS 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();
                    txtName.Text       = SQLConn.dr["Name"].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();
                    txt_money.Text     = SQLConn.dr["Money_Debt"].ToString();
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Ejemplo n.º 3
0
        private void LoadUpdateCategory()
        {
            try
            {
                SQLConn.sqL = "SELECT * FROM Category WHERE CategoryNo = '" + categoryID + "'";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    lblCategoryNo.Text  = SQLConn.dr["CategoryNo"].ToString();
                    txtCatName.Text     = SQLConn.dr["CategoryName"].ToString();
                    txtDescription.Text = SQLConn.dr["Description"].ToString();
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text != "")
                {
                    int i = Convert.ToInt32(textBox1.Text);

                    SQLConn.sqL = "SELECT * FROM payment WHERE InvoiceNo LIKE '" + i + "'";
                    SQLConn.ConnDB();
                    SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                    SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                    if (SQLConn.dr.Read() == true)
                    {
                        frmPrint abcd = new frmPrint(i, "frmPOS");
                        abcd.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Error:Invalid InvoiceNo.");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            this.Close();
        }
Ejemplo n.º 5
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         = "rahman_educational_service";
             mb.ImportInfo.DatabaseDefaultCharSet = "utf8";
             mb.ImportFromFile(file);
             // LoadStaffs("");
             MessageBox.Show("Restoring Successfully Completed.");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Restroring UnSuccessfull. " + ex);
     }
 }
Ejemplo n.º 6
0
        public void LoadStaffs(string search)
        {
            try
            {
                SQLConn.sqL = "SELECT StaffID, CONCAT(Firstname, ', ', Lastname, ' ') as ClientName, CONCAT(Street, ', ', Area, ', ', City , ', ', Province) as Address, ContactNo, username, role FROM Staff WHERE Firstname LIKE '" + search.Trim() + "%' ORDER By Firstname";
                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["StaffId"].ToString());
                    x.SubItems.Add(SQLConn.dr["ClientName"].ToString());
                    x.SubItems.Add(SQLConn.dr["ContactNo"].ToString());
                    x.SubItems.Add(SQLConn.dr["Address"].ToString());
                    x.SubItems.Add(SQLConn.dr["username"].ToString());
                    x.SubItems.Add(SQLConn.dr["Role"].ToString());

                    ListView1.Items.Add(x);
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.Message);
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Ejemplo n.º 7
0
        private void GetProductInfo()
        {
            try
            {
                SQLConn.sqL = "SELECT ProductCode, Description, UnitPrice, StocksOnHand FROM Product WHERE ProductNo =" + productID + "";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    lblProductCode.Text   = SQLConn.dr[0].ToString();
                    lblDescription.Text   = SQLConn.dr[1].ToString();
                    lblPrice.Text         = Strings.FormatNumber(SQLConn.dr[2]).ToString();
                    lblCurrentStocks.Text = SQLConn.dr[3].ToString();
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Ejemplo n.º 8
0
        private void GetCategoryNo()
        {
            try
            {
                SQLConn.sqL = "SELECT CategoryNo FROM Category ORDER BY CategoryNo DESC";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    lblCategoryNo.Text = (Convert.ToInt32(SQLConn.dr["CategoryNo"]) + 1).ToString();
                }
                else
                {
                    lblCategoryNo.Text = "1";
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Ejemplo n.º 9
0
        public void LoadCategories(string strSearch)
        {
            try
            {
                SQLConn.sqL = "SELECT * FROM CATEGORY WHERE CategoryName LIKE '" + strSearch + "%' ORDER By CategoryNO";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.dr  = SQLConn.cmd.ExecuteReader(CommandBehavior.CloseConnection);

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

                while (SQLConn.dr.Read() == true)
                {
                    x = new ListViewItem(SQLConn.dr["CategoryNo"].ToString());
                    x.SubItems.Add(SQLConn.dr["CategoryName"].ToString());
                    x.SubItems.Add(SQLConn.dr["Description"].ToString());
                    ListView1.Items.Add(x);
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Ejemplo n.º 10
0
        private void LoadCategory()
        {
            try
            {
                SQLConn.sqL = "SELECT * FROM Category WHERE CategoryName LIKE '" + txtCatName.Text + "%' ORDER BY CategoryNo ";
                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["CategoryNo"].ToString());
                    x.SubItems.Add(SQLConn.dr["CategoryName"].ToString());
                    x.SubItems.Add(SQLConn.dr["Description"].ToString());

                    ListView1.Items.Add(x);
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Ejemplo n.º 11
0
        public void AutoCompleteText(bool chec)
        {
            item_des_text.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            item_des_text.AutoCompleteSource = AutoCompleteSource.CustomSource;
            AutoCompleteStringCollection coll = new AutoCompleteStringCollection();

            try
            {
                if (chec == true)
                {
                    SQLConn.sqL = "SELECT * FROM Product ";
                    SQLConn.ConnDB();
                    SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                    SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                    while (SQLConn.dr.Read() == true)
                    {
                        des = SQLConn.dr["Description"].ToString();
                        coll.Add(des);
                    }
                }
                else if (chec == false)
                {
                    string[] split = frmS.Split(',');

                    foreach (string item in split)
                    {
                        SQLConn.sqL = "SELECT *  FROM product  WHERE ProductNo = '" + item + "'";
                        SQLConn.ConnDB();
                        SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                        SQLConn.dr  = SQLConn.cmd.ExecuteReader();
                        while (SQLConn.dr.Read() == true)
                        {
                            des = SQLConn.dr["Description"].ToString();
                            coll.Add(des);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error :" + ex);
            }
            finally // only checking remove in case of error
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }


            item_des_text.AutoCompleteCustomSource = coll;
        }  //// Description textBox , Drop Down Class
Ejemplo n.º 12
0
        void addTransactionsDetails()
        {
            String quan;
            String itemcode;
            String itemdes;
            String unitP;
            String disc;
            String to;


            productNo = 0;
            try
            {
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    quan = dataGridView1.Rows[i].Cells[7].Value.ToString();
                    if (quan != "" && Convert.ToInt32(quan) > 0)
                    {
                        productNo = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value.ToString());


                        itemcode = dataGridView1.Rows[i].Cells[1].Value.ToString();

                        itemdes = dataGridView1.Rows[i].Cells[2].Value.ToString();

                        unitP = dataGridView1.Rows[i].Cells[3].Value.ToString();


                        disc = dataGridView1.Rows[i].Cells[5].Value.ToString();

                        to = dataGridView1.Rows[i].Cells[8].Value.ToString();



                        SQLConn.sqL = "INSERT INTO transactiondetails(InvoiceNo,ProductNo,ItemPrice,Quantity,Discount,perItem) VALUES('" + invoiceNo + "', '" + productNo + "', '" + unitP + "' ,'" + quan + "','" + disc + "','" + to + "')";
                        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();
            }
        }
Ejemplo n.º 13
0
        private void button3_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("daccounts");
                        abc.Add("saccounts");
                        abc.Add("debtin");
                        abc.Add("debtins");
                        abc.Add("payment");
                        abc.Add("transactions");
                        abc.Add("transactiondetails");
                        abc.Add("stockin");
                        abc.Add("staff");
                        abc.Add("product");
                        abc.Add("category");

                        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);
            }
        }
Ejemplo n.º 14
0
        public void AutoCompleteAccount()
        {
            accName.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            accName.AutoCompleteSource = AutoCompleteSource.CustomSource;
            AutoCompleteStringCollection accColl = new AutoCompleteStringCollection();

            try
            {
                if (accType.Text == "Distributor")
                {
                    SQLConn.sqL = "SELECT * FROM daccounts ";
                    SQLConn.ConnDB();
                    SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                    SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                    while (SQLConn.dr.Read() == true)
                    {
                        des = SQLConn.dr["Name"].ToString();
                        accColl.Add(des);
                    }
                }
                else if (accType.Text == "School Sale")
                {
                    SQLConn.sqL = "SELECT * FROM saccounts ";
                    SQLConn.ConnDB();
                    SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                    SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                    while (SQLConn.dr.Read() == true)
                    {
                        des = SQLConn.dr["Name"].ToString();
                        accColl.Add(des);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error :" + ex);
            }
            finally // only checking remove in case of error
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }


            accName.AutoCompleteCustomSource = accColl;
        }
Ejemplo n.º 15
0
        void addTransactions()
        {
            string accT = "";
            string no   = "";
            string name = "";

            if (accType.Text == "Counter Sale")
            {
                accT = "CS";
                no   = "0";
                name = accName.Text;
            }
            else if (accType.Text == "Distributor")
            {
                accT = "DS";
                no   = accNo.Text;
                name = accName.Text;
            }
            else if (accType.Text == "School Sale")
            {
                accT = "SS";
                no   = accNo.Text;
                name = accName.Text;
            }
            else
            {
                MessageBox.Show("Error.");
            }
            try
            {
                SQLConn.sqL = "INSERT INTO transactions(InvoiceNo,TDate,TTime,TotalAmount,StaffID,AccType,AccNo,AccName) VALUES('" + invoiceNo + "', '" + System.DateTime.Now.ToString("MM/dd/yyyy") + "', '" + System.DateTime.Now.ToString("hh:mm:ss") + "' ,'" + totalAmount + "','" + staffId + "','" + accT + "','" + no + "','" + name + "')";
                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();
            }
        }
Ejemplo n.º 16
0
        public void AEform()
        {
            string Fall = null;

            if (listView1.Items.Count == 0)
            {
                spring = null;
            }
            else
            {
                try
                {
                    for (int i = 0; i < listView1.Items.Count; ++i)
                    {
                        string abc = listView1.Items[i].Text.ToString();
                        SQLConn.sqL = "SELECT ProductNo  FROM product  WHERE Description = '" + abc + "'";
                        SQLConn.ConnDB();
                        SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                        SQLConn.dr  = SQLConn.cmd.ExecuteReader();

                        if (SQLConn.dr.Read() == true)
                        {
                            if (i == 0)
                            {
                                spring = SQLConn.dr["ProductNo"].ToString();
                            }
                            else
                            {
                                Fall   = SQLConn.dr["ProductNo"].ToString();
                                spring = string.Concat(spring, ",", Fall);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Interaction.MsgBox(ex.ToString());
                }
                finally
                {
                    SQLConn.cmd.Dispose();
                    SQLConn.conn.Close();
                }
            }
        }
Ejemplo n.º 17
0
 private void AddPayment(string t, string a, string od, string nd)
 {
     try
     {
         SQLConn.sqL = "INSERT INTO PAYMENT(InvoiceNo, Cash, PChange,AccType,AccNo,OldDebt,NewDebt) VALUES('" + InvoiceNo + "', '" + txtCash.Text.Replace(",", "") + "', '" + txtChange.Text.Replace(",", "") + "', '" + t + "' ,'" + a + "','" + od.Replace(",", "") + "','" + nd.Replace(",", "") + "')";
         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();
     }
 }
Ejemplo n.º 18
0
 private void UpdateAccountDebt()
 {
     try
     {
         SQLConn.sqL = "UPDATE daccounts SET DateIN='" + System.DateTime.Now.ToString("MM-dd-yyyy") + "',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();
     }
 }
Ejemplo n.º 19
0
 private void UpdateProductQuantity()
 {
     try
     {
         SQLConn.sqL = "UPDATE Product SET StocksOnhand = StocksOnHand + '" + quantity + "' WHERE ProductNo = '" + productNo + "'";
         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();
     }
 }
Ejemplo n.º 20
0
 private void AddStockIn()
 {
     try
     {
         SQLConn.sqL = "INSERT INTO StockIn(ProductNo, Quantity, DateIn) Values('" + lblProductNo.Text + "', '" + txtStocksOnHand.Text + "', '" + System.DateTime.Now.ToString("MM/dd/yyyy") + "')";
         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();
     }
 }
Ejemplo n.º 21
0
 public void insert_SchoolSale()
 {
     try
     {
         SQLConn.sqL = "UPDATE saccounts SET Money_Debt='" + txNewDebt.Text.Replace(",", "") + "',DateIN='" + System.DateTime.Now.ToString("MM-dd-yyyy") + "' where AccountID='" + AccNo + "'";
         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();
     }
 }
Ejemplo n.º 22
0
        private void Login()
        {
            try
            {
                SQLConn.sqL = "SELECT * FROM Staff WHERE Username = '******' AND UPassword = '******'";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                // MessageBox.Show(SQLConn.sqL.ToString());
                SQLConn.dr = SQLConn.cmd.ExecuteReader();

                if (SQLConn.dr.Read() == true)
                {
                    if (SQLConn.dr["Role"].ToString().ToUpper() == "ADMIN")
                    {
                        frmMain m = new frmMain(SQLConn.dr["Username"].ToString(), Convert.ToInt32(SQLConn.dr["StaffID"]));
                        //  waitsplash();
                        m.Show();
                        this.Hide();
                    }
                    else
                    {
                        frmMain m = new frmMain(SQLConn.dr["Username"].ToString(), Convert.ToInt32(SQLConn.dr["StaffID"]));
                        //  waitsplash();
                        m.Show();
                        this.Hide();
                    }
                }
                else
                {
                    Interaction.MsgBox("Invalid Password. Please try again.", MsgBoxStyle.Exclamation, "Login");
                }
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.Message);
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Ejemplo n.º 23
0
 private void UpdateStaff()
 {
     try
     {
         SQLConn.sqL = "Update saccounts SET  Name = '" + txtName.Text + "', Area = '" + txtArea.Text + "', City = '" + txtCity.Text + "', ContactNo = '" + txtContractNo.Text + "', ShopNo = '" + txtShopNo.Text + "', Money_Debt = '" + txt_money.Text + "' , form= '" + spring + "' 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();
     }
 }
Ejemplo n.º 24
0
 private void AddStaff()
 {
     try
     {
         SQLConn.sqL = "INSERT INTO saccounts( Name, Area, City, ContactNo,ShopNo, Money_Debt ,form ) VALUES( '" + txtName.Text + "', '" + txtArea.Text + "', '" + txtCity.Text + "', '" + txtContractNo.Text + "', '" + txtShopNo.Text + "', '" + txt_money.Text + "','" + spring + "')";
         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();
     }
 }
Ejemplo n.º 25
0
 private void UpdateStaff()
 {
     try
     {
         SQLConn.sqL = "Update STAFF SET  Firstname = '" + txtFirstname.Text + "',Lastname = '" + txtLastname.Text + "', Street= '" + txtStreet.Text + "', Area = '" + txtArea.Text + "', City = '" + txtCity.Text + "', Province = '" + txtProvince.Text + "', ContactNo = '" + txtContractNo.Text + "', Username ='******', Role = '" + txtRole.Text + "', UPassword = '******' WHERE StaffID = '" + LSStaffID + "'";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
         Interaction.MsgBox("Staff record successfully updated", MsgBoxStyle.Information, "Update Staff");
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Ejemplo n.º 26
0
 private void AddCategory()
 {
     try
     {
         SQLConn.sqL = "INSERT INTO Category(CategoryName, Description) VALUES('" + txtCatName.Text + "', '" + txtDescription.Text + "')";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
         Interaction.MsgBox("New category successfully added.", MsgBoxStyle.Information, "Add Category");
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Ejemplo n.º 27
0
 private void UpdateCategory()
 {
     try
     {
         SQLConn.sqL = "UPDATE Category SET CategoryName= '" + txtCatName.Text + "', Description = '" + txtDescription.Text + "' WHERE CategoryNo = '" + categoryID + "'";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
         Interaction.MsgBox("Category successfully updated.", MsgBoxStyle.Information, "Update Category");
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Ejemplo n.º 28
0
 private void AddStaff()
 {
     try
     {
         SQLConn.sqL = "INSERT INTO STAFF( Firstname,Lastname, Street, Area, City, Province, ContactNo, Username, Role, UPassword) VALUES( '" + txtFirstname.Text + "','" + txtLastname.Text + "', '" + txtStreet.Text + "', '" + txtArea.Text + "', '" + txtCity.Text + "', '" + txtProvince.Text + "', '" + txtContractNo.Text + "', '" + txtUsername.Text + "', '" + txtRole.Text + "', '" + txtPassword.Text + "')";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
         Interaction.MsgBox("New staff successfully added.", MsgBoxStyle.Information, "Add Staff");
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.ToString());
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }
Ejemplo n.º 29
0
        private void UpdateProduct()
        {
            try
            {
                SQLConn.sqL = "UPDATE Product SET ProductCode = '" + txtProductCode.Text + "', Description = '" + txtDescription.Text + "', UnitPrice = '" + txtUnitPrice.Text.Replace(",", "") + "', StocksOnHand = '" + txtStocksOnHand.Text.Replace(",", "") + "', CategoryNo ='" + categoryID + "' WHERE ProductNo = '" + productID + "'";
                SQLConn.ConnDB();
                SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
                SQLConn.cmd.ExecuteNonQuery();

                Interaction.MsgBox("Product successfully Updated.", MsgBoxStyle.Information, "Update Product");
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.ToString());
            }
            finally
            {
                SQLConn.cmd.Dispose();
                SQLConn.conn.Close();
            }
        }
Ejemplo n.º 30
0
 private void AddProducts()
 {
     try
     {
         SQLConn.sqL = "INSERT INTO Product(ProductCode, Description, UnitPrice, StocksOnHand, CategoryNo) VALUES('" + txtProductCode.Text + "', '" + txtDescription.Text + "', '" + txtUnitPrice.Text.Replace(",", "") + "', '" + txtStocksOnHand.Text.Replace(",", "") + "',  '" + categoryID + "')";
         SQLConn.ConnDB();
         SQLConn.cmd = new MySqlCommand(SQLConn.sqL, SQLConn.conn);
         SQLConn.cmd.ExecuteNonQuery();
         Interaction.MsgBox("Product successfully added.", MsgBoxStyle.Information, "Add Product");
         AddStockIn();
     }
     catch (Exception ex)
     {
         Interaction.MsgBox(ex.Message);
     }
     finally
     {
         SQLConn.cmd.Dispose();
         SQLConn.conn.Close();
     }
 }