Пример #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                //delete item now
                DialogResult res = MessageBox.Show("ARE YOU SURE YOU WANT TO DELETE ITEM : " + itemname.Text + " COMPLETELY", "SYSTEM CONFIRMATION", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (res == DialogResult.Yes)
                {
                    HorsePower.ExecuteSQL("DELETE FROM `stock` WHERE `ItemName`='" + itemname.Text + "' AND `Code` = '" + code.Text + "'");

                    MessageBox.Show("Item Deleted/Removed From Current Stock DB", "Green Care POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    itemname.Text   = "";
                    code.Text       = "";
                    quantity.Text   = "";
                    categories.Text = "";
                    units.Text      = "";
                    bp.Text         = "";
                    supplier.Text   = "";
                    button1.Visible = true;
                    button2.Visible = false;
                    button3.Visible = false;
                    button4.Visible = false;
                    get();
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
        }
Пример #2
0
 private void UpdateStock_Load(object sender, EventArgs e)
 {
     try
     {
         MySqlCommand cmd = HorsePower.OpenConnection().CreateCommand();
         cmd.CommandText = "Select * From stock  WHERE `ItemName` like '" + itemname.Text + "'";
         MySqlDataReader read = cmd.ExecuteReader();
         if (read.Read())
         {
             code.Text        = read.GetString(0);
             textBox1.Text    = read.GetString(1);
             quantity.Text    = read.GetString(2);
             units.Text       = read.GetString(4);
             bp.Text          = read.GetString(5);
             supplier.Text    = read.GetString(6);
             newitem.Text     = read.GetString(1);
             newunits.Text    = read.GetString(4);
             newsupplier.Text = read.GetString(6);
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #3
0
        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            string itm = (String)listBox1.SelectedItem;

            if (checkBox2.Checked == true)
            {
                checkBox2.Text = "Cooked";
                try

                {
                    dataGridView1.DataSource = HorsePower.Select("SELECT `Name`, `Price` FROM `itemsmenu` WHERE `Status` ='Cooked'");
                }
                catch (Exception ex)
                {
                    Console.Write(ex);
                }
            }
            else
            {
                try

                {
                    checkBox2.Text = "UnCooked";


                    dataGridView1.DataSource = HorsePower.Select("SELECT `Name`, `Price` FROM `itemsmenu` WHERE `Status` = 'UnCooked'");
                }
                catch (Exception ex)
                {
                    Console.Write(ex);
                }
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            //check if there is an existing shift

            try
            {
                DataGridViewRow row       = this.dataGridView1.SelectedRows[0];
                String          number    = row.Cells[0].Value.ToString();
                String          firstname = row.Cells[1].Value.ToString();
                String          lastname  = row.Cells[2].Value.ToString();
                DateTime        d         = DateTime.Now;
                String          Time      = d.ToString("t");
                if (check(number, dateTimePicker1.Text))
                {
                    MessageBox.Show("Sorry But : " + firstname + lastname + " Has Already Started Shift", "Hotel POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    //insert to db
                    String QSL = "INSERT INTO `shift`(`IDNumber`,`FullNames`, `Date`,`StartTime`) VALUES ('" + number + "','" + firstname + lastname + "','" + dateTimePicker1.Text + "','" + Time + "')";

                    HorsePower.ExecuteSQL(QSL);

                    //get shifts
                    getShifts();
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
        }
Пример #5
0
 void SendMail()
 {
     try
     {
         //send mail
         MailMessage Msg = new MailMessage();
         Msg.From = new MailAddress(from.Text);
         Msg.To.Add(recepient.Text);
         Msg.Subject = subject.Text;
         Msg.Body    = message.Text;
         SmtpClient smtp = new SmtpClient();
         smtp.Host        = "smtp.gmail.com";
         smtp.Port        = 587;
         smtp.Credentials = new System.Net.NetworkCredential(from.Text, password.Text);
         smtp.EnableSsl   = true;
         smtp.Send(Msg);
         //save the record in db
         DateTime d   = DateTime.Now;
         string   add = "INSERT INTO `MailMaster`(`To`, `From`, `Date`, `Subject`, `Message`, `Attachments`) VALUES  ('" + recepient.Text + "','" + from.Text + "','" + d.ToString() + "','" + subject.Text + "','" + message.Text + "','" + listBox1.Items.Count + "')";
         HorsePower.ExecuteSQL(add);
         MessageBox.Show("Email Sent and Saved", "Mail Master", MessageBoxButtons.OK, MessageBoxIcon.Information);
         loadMails();
     }
     catch (SmtpException ex)
     {
         MessageBox.Show("Cannot Send E-Mail : " + ex);
     }
 }
Пример #6
0
 private void SalesReport_Load(object sender, EventArgs e)
 {
     treeView1.ExpandAll();
     HorsePower.FillCombo(comboBox1, "SELECT `Name` FROM `itemsmenu` WHERE 1");
     //HorsePower.FillCombo(comboBox2, "SELECT `Username` FROM `login2` WHERE 1");
     HorsePower.FillCombo(comboBox2, "SELECT CONCAT(FirstName,LastName) FROM workers;");
 }
Пример #7
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         MySqlCommand cmd = HorsePower.OpenConnection().CreateCommand();
         cmd.CommandText = "Select `AccountNumber`, `AccountName`, `Bank`, `Signitory`,  `Amount` From  `account`  WHERE `AccountName` = '" + comboBox1.Text + "'";
         MySqlDataReader read = cmd.ExecuteReader();
         if (read.Read())
         {
             accountnumber.Text = read.GetString(0);
             accountname.Text   = read.GetString(1);
             bankname.Text      = read.GetString(2);
             signitory.Text     = read.GetString(3);
             amount.Text        = read.GetString(4);
         }
         else
         {
             accountnumber.Text = "";
             bankname.Text      = "";
             signitory.Text     = "";
             amount.Text        = "";
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #8
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         DateTime     date = DateTime.Now;
         DialogResult res  = MessageBox.Show("Be Sure Because This Will Reduce Stock", "Stock", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (res == DialogResult.Yes)
         {
             //REDECE STOCK
             ReduceQty(textBox1.Text, textBox2.Text);
             //ADD TO LIST
             ListViewItem lv = new ListViewItem(new String[] { textBox1.Text, textBox2.Text });
             listView1.Items.Add(lv);
             Reload();
             HorsePower.ExecuteSQL("INSERT INTO `StockOut`(`Code`, `Name`, `Date`, `QuantityOut`, `Notes`) VALUES ('" + code.Text + "','" + textBox1.Text + "','" + date + "','" + textBox2.Text + "','" + textBox3.Text + "')");
         }
         else
         {
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #9
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || comboBox1.Text == "")
         {
             MessageBox.Show("Please Fill Account Details", "Invalid Account", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             //check if account exists
             MySqlCommand cmd = HorsePower.OpenConnection().CreateCommand();
             cmd.CommandText = "Select * From  `account`  WHERE `AccountNumber` = '" + textBox1.Text + "'";
             MySqlDataReader read = cmd.ExecuteReader();
             if (read.Read())
             {
                 MessageBox.Show("Duplicate Account Exists", "Account", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
             else
             {
                 //create account
                 String SQLQUERY = "INSERT INTO `account`(`AccountNumber`, `AccountName`, `Bank`, `DateOpened`, `Signitory`, `Accounttype`, `Amount`) VALUES ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + dateTimePicker1.Text + "','" + textBox4.Text + "','" + comboBox1.Text + "','" + textBox5.Text + "')";
                 HorsePower.ExecuteSQL(SQLQUERY);
                 MessageBox.Show("Account Information Saved", "Account", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         //check user account
         String AS = "SELECT `Username`, `Role`, `Password` FROM `login2` WHERE `Username` = '" + comboBox2.Text + "' AND `Role` = 'Admin' AND `Password` = '" + textBox1.Text + "'";
         // V2MySqlServer v2 = new V2MySqlServer(Server.getIP(), "root", "", "hotel");
         MySqlCommand cmd = HorsePower.OpenConnection().CreateCommand();
         cmd.CommandText = AS;
         MySqlDataReader read = cmd.ExecuteReader();
         if (read.Read())
         {
             if (!comboBox1.Text.Equals(""))
             {
                 //proceed to transfer money
                 int total = int.Parse(amount.Text) + int.Parse(tobank.Text);
                 //confirm from user
                 DialogResult res = MessageBox.Show("AMOUNT KSH:" + tobank.Text + " \n WILL BE TRANSFERED TO : " + bankname.Text + " \n ON : " + dateTimePicker1.Text + " \n BY : " + comboBox2.Text, "CONFIRM", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (res == DialogResult.Yes)
                 {
                     textBox1.Text    = "";
                     textBox1.Visible = false;
                     label11.Visible  = false;
                     //proceed
                     HorsePower.ExecuteSQL("UPDATE `account` SET `Amount`='" + total.ToString() + "' WHERE `AccountNumber` ='" + accountnumber.Text + "' AND `AccountName` = '" + accountname.Text + "'");
                     //save transaction trail
                     TransactionTrail();
                     //clear everything
                     accountname.Text   = "";
                     accountnumber.Text = "";
                     bankname.Text      = "";
                     signitory.Text     = "";
                     amount.Text        = "";
                     tobank.Text        = "";
                     source.Text        = "";
                     //refresh the account balance
                     RefreshAccount(comboBox1.Text);
                 }
                 else
                 {
                     MessageBox.Show("Oooh No ! You Have Not Selected Bank Account", "Invalid Parameters", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 }
             }
             //do nothing
         }
         else
         {
             //do not do anything
             MessageBox.Show("Sorry You Do Not Have Sufficient To Complete This Operation", "Invalid Account", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             textBox1.Text    = "";
             textBox1.Visible = false;
             label11.Visible  = false;
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            String SQL = "UPDATE `itemsmenu` SET `Price`='" + newprice.Text + "'  WHERE  `Name`= '" + name.Text + "'";

            HorsePower.ExecuteSQL(SQL);
            newprice.Text = "";
            ReloadGrid();
        }
Пример #12
0
 private void textBox2_TextChanged(object sender, EventArgs e)
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `OrderNumber`,`Status`, `Total`, `Waiter` FROM `orders` WHERE `Waiter` LIKE '" + textBox2.Text + "%'");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #13
0
 private void OrdersApproval_Load(object sender, EventArgs e)
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `OrderNumber`,`Status`, `Total`, `Waiter` FROM `orders` WHERE `Status` = 'Open' AND `Date` = '" + dateTimePicker1.Text + "'");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #14
0
 public void Loads()
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `ItemName` FROM `ItemCategories` WHERE 1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #15
0
 private void ReloadGrid()
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `Name`, `Quantity`, `Price` FROM `itemsmenu` WHERE 1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #16
0
        private void button4_Click(object sender, EventArgs e)
        {
            int total = int.Parse(textBox2.Text) - int.Parse(add.Text);

            //update the db
            HorsePower.ExecuteSQL("UPDATE `openingbalance` SET `Amount`='" + total.ToString() + "' WHERE `FullNames`='" + textBox1.Text + "' AND `Date` = '" + dateTimePicker1.Text + "'");
            //reload the datagrid
            LoadStuff();
            //hide me
            groupBox1.Visible = false;
        }
Пример #17
0
 public void get()
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `FirstName`, `LastName` FROM `workers` WHERE 1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #18
0
 void LoadStatus()
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `Name`, `Price`, `Type`, `Details`, `Availability`,`Status` FROM `itemsmenu` WHERE 1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #19
0
 private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `OrderNumber`, `Date`, `Status`, `Total`, `Waiter`,`OrderStatus` FROM `Orders` WHERE `TableNumber`='" + comboBox2.Text + "'");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error Unable To Load data", "Error");
     }
 }
Пример #20
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `OrderNumber`,`Status`, `Total`, `Waiter` FROM `orders` WHERE `Status` = '" + comboBox1.Text + "' ");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #21
0
 private void LoadAllWorkers()
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `FirstName`, `LastName`, `IDNumber`, `Gender`, `Telephone`, `Residence`, `WorkPosition`, `Salary`, `PaymentMode`, `WorkingDuration` FROM `workers` WHERE 1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #22
0
 private void ItemStatus_Load(object sender, EventArgs e)
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `Name`, `Price`, `Type`, `Details`, `Availability`,`Status` FROM `itemsmenu` WHERE 1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #23
0
 public void LoadStuff()
 {
     try
     {
         dataGridView2.DataSource = HorsePower.Select("SELECT `FullNames`,  `Amount`,`Status` FROM `OpeningBalance` WHERE `Date` = '" + dateTimePicker1.Text + "'");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #24
0
 private void LoadStatus2(string text)
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `Name`, `Price`, `Type`, `Details`, `Availability`,`Status` FROM `itemsmenu` WHERE `Status` = '" + comboBox1.Text + "'");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #25
0
 private void gettable()
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT * FROM `Table` WHERE 1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #26
0
 private void Suppliers_Load(object sender, EventArgs e)
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT * FROM `Suppliers` WHERE 1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #27
0
 public void get()
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT * FROM `Suppliers` WHERE 1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #28
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         dataGridView1.DataSource = HorsePower.Select("SELECT `Name`, `Quantity`, `Price` FROM `itemsmenu` WHERE `Availability` = '" + comboBox1.Text + "'");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #29
0
 private void getUnits()
 {
     try
     {
         dataGridView2.DataSource = HorsePower.Select("SELECT * FROM `Units` WHERE 1");
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }
Пример #30
0
 private void LoadCategories()
 {
     try
     {
         HorsePower.LoadList(listBox1);
     }
     catch (Exception ex)
     {
         Console.Write(ex);
     }
 }