コード例 #1
0
ファイル: setting.cs プロジェクト: rochana-atapattu/harasara
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            databaseAccess d1 = new databaseAccess();

            string query = "select count(*) from supplier where supplierName='" + textBox1.Text + "'";

            if (1 == (d1.getValue(query)))
            {
                string supID         = "select SupID from supplier  where supplierName='" + textBox1.Text + "'";
                string contactNumber = "select contactNumber from supplier  where supplierName='" + textBox1.Text + "'";
                string Address       = "select Address from supplier  where supplierName='" + textBox1.Text + "'";
                string Bank          = "select Bank from supplier where supplierName='" + textBox1.Text + "'";
                string AccountNumber = "select AccountNumber from supplier  where supplierName='" + textBox1.Text + "'";

                textBox6.Text     = d1.getString(supID);
                textBox2.Text     = d1.getString(contactNumber);
                richTextBox2.Text = d1.getString(Address);
                comboBox2.Text    = d1.getString(Bank);
                textBox7.Text     = d1.getString(AccountNumber);

                string query2 = "select * from itemsandsupplier where  SupID='" + textBox6 + "'";
                d1.displayData(query2, dataGridView1);
            }
            else
            {
                textBox6.Text     = null;
                textBox2.Text     = null;
                richTextBox2.Text = null;
                comboBox2.Text    = null;
                textBox7.Text     = null;
            }
        }
コード例 #2
0
ファイル: setting.cs プロジェクト: rochana-atapattu/product1
        private void update_Click(object sender, EventArgs e)
        {
            databaseAccess d1    = new databaseAccess();
            string         query = "update harasara.supplier set (supplierName='" + textBox1.Text + "',contactNumber='" + textBox2.Text + "',Address='" + richTextBox2.Text + "',Bank='" + comboBox2.Text + "',AccountNumber='" + textBox7.Text + "')";

            d1.InsertData(query);
        }
コード例 #3
0
        private void PurchasingOrders_Load(object sender, EventArgs e)
        {
            string         query = "select item_id,name,type,price from harasara.inventory where count=rol";
            databaseAccess d1    = new databaseAccess();

            d1.displayData(query, dataGridView1);
        }
コード例 #4
0
ファイル: setting.cs プロジェクト: rochana-atapattu/product1
        public setting()
        {
            InitializeComponent();
            databaseAccess d1 = new databaseAccess();

            d1.AutoCompelte(textBox6, "select * from harasara.supplier", "SupID");
        }
コード例 #5
0
ファイル: setting.cs プロジェクト: rochana-atapattu/harasara
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string         query = "select item_id from harasara.inventory where name='" + comboBox1.Text + "'";
            databaseAccess d1    = new databaseAccess();

            label10.Text = d1.getString(query);
        }
コード例 #6
0
ファイル: setting.cs プロジェクト: rochana-atapattu/harasara
        private void update_Click(object sender, EventArgs e)
        {
            string         query = "UPDATE supplier SET  supplierName='" + textBox1.Text + "', contactNumber='" + textBox2.Text + "', Address='" + richTextBox2.Text + "',Bank='" + comboBox2.Text + "',AccountNumber='" + textBox7.Text + "' where SupID='" + textBox6.Text + "'";
            databaseAccess d1    = new databaseAccess();

            d1.InsertData(query);
        }
コード例 #7
0
        private void Add_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(quantity.Text))
            {
                error.ForeColor = Color.Red;
                error.Text      = "Please,Input Qunantity";
            }
            else if (String.IsNullOrWhiteSpace(comboBox1.Text))
            {
                error.ForeColor = Color.Red;
                error.Text      = "Select Supplier";
            }
            else
            {
                databaseAccess d1     = new databaseAccess();
                int            qu     = Convert.ToInt32(quantity.Text);
                int            Index  = dataGridView1.SelectedRows[0].Index;
                int            itemID = Convert.ToInt32(dataGridView1.Rows[Index].Cells[0].Value);
                string         desc   = dataGridView1.Rows[Index].Cells[1].Value.ToString();
                double         price  = Convert.ToDouble(dataGridView1.Rows[Index].Cells[3].Value);

                double tPrice = qu * price;

                string query = "insert into harasara.ordereditems (ItemNo,ItemDescription,Price,Quantity,TotalPrice,SupplierId,Date)values ('" + itemID + "','" + desc + "','" + price + "','" + qu + "','" + tPrice + "','" + comboBox1.Text + "','" + dateTimePicker1.Text + "')";
                d1.InsertData(query);
                d1.deleteSelectedRow(dataGridView1);
                string query1 = "select * from harasara.ordereditems where Date='" + dateTimePicker1.Text + "'";
                d1.displayData(query1, dataGridView2);
            }
        }
コード例 #8
0
        public SalesOrders()
        {
            InitializeComponent();
            databaseAccess d1 = new databaseAccess();

            d1.AutoCompelte(textBox5, "select * from harasara.customer", "customerName");
        }
コード例 #9
0
        //loading table when text on the Customer Text Changed
        private void cusText_TextChanged(object sender, EventArgs e)
        {
            string         query = "select * from slorders where cusName LIKE '" + cusText.Text + "%' ";
            databaseAccess d1    = new databaseAccess();

            d1.displayData(query, dataGridView1);
        }
コード例 #10
0
        private void textBox5_Leave(object sender, EventArgs e)
        {
            string         query = "select * from harasara.customer where customerName='" + textBox5.Text + "' ";
            databaseAccess d1    = new databaseAccess();

            if (label22.Text == "XXXXXX")
            {
コード例 #11
0
        public Bill(string cusName, string conNumber, string address, string Email, string OrID, string finalPrice, string ID, int nu)
        {
            InitializeComponent();
            radioButton3.Enabled = false;
            radioButton4.Enabled = false;
            textBox1.Enabled     = false;

            cusBill.Text       = cusName;
            conNumberBill.Text = conNumber;
            addBill.Text       = address;
            emailBill.Text     = Email;
            invoiceBill.Text   = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString();
            label2.Text        = OrID;
            label1.Text        = finalPrice;
            label8.Text        = ID;
            if (nu == 2)
            {
                label7.Text = "SupplierID";
            }

            if (nu == 1)
            {
                string         query = "select * from harasara.products where orderID='" + OrID + "'";
                databaseAccess db1   = new databaseAccess();
                db1.displayData(query, BillProducts);
            }
            else
            {
                string         dquery = "select Date from purchaseorders where OrderId='" + OrID + "' ";
                databaseAccess d2     = new databaseAccess();
                string         ddate  = d2.getString(dquery);

                string query3 = "select ItemNo,ItemDescription,Price,Quantity,TotalPrice from purchaseorders where OrderId='" + OrID + "'";
            }
        }
コード例 #12
0
        private void button2_Click(object sender, EventArgs e)
        {
            databaseAccess d1 = new databaseAccess();

            con.Open();
            cmd             = con.CreateCommand();
            cmd.CommandType = CommandType.Text;

            string query = "select SupplierId,sum(TotalPrice) from harasara.ordereditems where Date='" + dateTimePicker1.Text + "'  group by SupplierId";

            cmd.CommandText = query;

            MySqlDataAdapter da = new MySqlDataAdapter(cmd);
            DataTable        dt = new DataTable();

            da.Fill(dt);
            con.Close();
            foreach (DataRow dr in dt.Rows)
            {
                string id  = dr[0].ToString();
                double ppp = Convert.ToDouble(dr[1]);

                string query1 = "insert into harasara.purchaseorders (SupplierId,Price,Date) values ('" + id + "','" + ppp + "','" + dateTimePicker1.Text + "')";
                d1.InsertData(query1);
            }
コード例 #13
0
ファイル: setting.cs プロジェクト: rochana-atapattu/product1
        private void setting_Load(object sender, EventArgs e)
        {
            string query = "select * from harasara.inventory ";

            databaseAccess d1 = new databaseAccess();

            d1.ComboBoxLoad("item_id", comboBox1, query);
        }
コード例 #14
0
ファイル: setting.cs プロジェクト: rochana-atapattu/harasara
        public setting()
        {
            InitializeComponent();
            databaseAccess d1 = new databaseAccess();

            d1.AutoCompleteText(textBox1, "select * from supplier", "supplierName");
            d1.AutoCompleteText(textBox4, "select * from customer", "customerName");
        }
コード例 #15
0
        //Dispay th all orders in form
        private void SalesOrders_Load(object sender, EventArgs e)
        {
            string query = "select * from harasara.slorders";

            databaseAccess d1 = new databaseAccess();

            d1.displayData(query, dataGridView1);
        }
コード例 #16
0
        private void textBox1_Leave(object sender, EventArgs e)
        {
            string query = "select max(orderID) from ordereditems";

            databaseAccess d1 = new databaseAccess();

            label8.Text = (d1.getValue(query) + 1).ToString();
        }
コード例 #17
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string query = "select distinct supplierName from harasara.supplier where SupID='" + comboBox1.Text + "'";

            databaseAccess d1 = new databaseAccess();

            label4.Text = d1.getString(query);
        }
コード例 #18
0
        private void Add1_Click(object sender, EventArgs e)
        {
            string query = "select * from slorders";

            addOrderDetails();
            databaseAccess d1 = new databaseAccess();

            d1.displayData(query, dataGridView1);
        }
コード例 #19
0
ファイル: setting.cs プロジェクト: rochana-atapattu/product1
        private void button1_Click(object sender, EventArgs e)
        {
            string         query  = "insert into harasara.itemsandsupplier (SupID,ItemNo,ItemDescription) values ('" + textBox6.Text + "','" + Convert.ToInt32(comboBox1.Text) + "','" + label10.Text + "')";
            string         query1 = "select * from harasara.itemsandsupplier";
            databaseAccess d1     = new databaseAccess();

            d1.InsertData(query);
            d1.displayData(query1, dataGridView1);
        }
コード例 #20
0
        public PurchasingOrders()
        {
            InitializeComponent();

            databaseAccess d1 = new databaseAccess();

            d1.AutoCompleteText(textBox1, "select * from supplier", "supplierName");
            d1.AutoCompleteText(textBox3, "select * from supplier", "supplierName");
        }
コード例 #21
0
        private void button2_Click(object sender, EventArgs e)
        {
            databaseAccess d1    = new databaseAccess();
            string         total = "select sum(TotalPrice) from ordereditems where orderID='" + Convert.ToInt32(label8.Text) + "'";

            double finalPrice = d1.getValue(total);
            string query      = "insert into purchaseorders values ('" + Convert.ToInt32(label8.Text) + "','" + label9.Text + "','" + finalPrice + "','" + dateTimePicker1.Text + "')";

            d1.InsertData(query);
            CustomMsgBox.Show("Your order is succefully processed", "OK");
        }
コード例 #22
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int Index = dataGridView1.SelectedRows[0].Index;

            int ItemID = Convert.ToInt32(dataGridView1.Rows[Index].Cells[0].Value);

            string         query = "select distinct(SupID) from harasara.itemsandsupplier where ItemNo='" + ItemID + "'";
            databaseAccess d1    = new databaseAccess();

            d1.ComboBoxLoad("SupID", comboBox1, query);
        }
コード例 #23
0
        private void button1_Click(object sender, EventArgs e)
        {
            double         tprice = (Convert.ToDouble(label14.Text)) * (Convert.ToInt32(textBox2.Text));
            string         query  = "insert into ordereditems values ('" + Convert.ToInt32(label8.Text) + "','" + Convert.ToInt32(label10.Text) + "','" + comboBox1.Text + "','" + Convert.ToDouble(label14.Text) + "','" + Convert.ToInt32(textBox2.Text) + "','" + tprice + "','" + label9.Text + "','" + dateTimePicker1.Text + "')";
            databaseAccess d1     = new databaseAccess();

            d1.InsertData(query);
            string query2 = "select * from ordereditems where orderId='" + label8.Text + "' ";


            d1.displayData(query2, dataGridView1);
        }
コード例 #24
0
        private void comboBox1_TextChanged(object sender, EventArgs e)
        {
            string         query  = "select contactNumber from customer where customerName='" + comboBox1.Text + "'";
            string         query2 = "select customerID from customer where customerName='" + comboBox1.Text + "'";
            databaseAccess d1     = new databaseAccess();

            textBox5.Text = d1.getString(query);
            string cusID = d1.getString(query2);

            string query3 = "select * from payments where customerID='" + cusID + "'";

            d1.displayData(query3, dataGridView1);
        }
コード例 #25
0
        private void payments_Load(object sender, EventArgs e)
        {
            databaseAccess d1     = new databaseAccess();
            string         query1 = "select * from payments";
            string         query2 = "select * from customer";
            string         query3 = "select * from supplier";
            string         query4 = "select * from purchasepayments";

            d1.displayData(query1, dataGridView1);
            d1.displayData(query4, dataGridView2);
            d1.ComboBoxLoad("customerName", comboBox1, query2);
            d1.ComboBoxLoad("supplierName", comboBox4, query3);
        }
コード例 #26
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            databaseAccess d1     = new databaseAccess();
            string         itemNo = "select ItemNo from itemsandsupplier where ItemDescription='" + comboBox1.Text + "'";


            label10.Text = d1.getString(itemNo);
            string query = "select price from inventory where item_id ='" + label10.Text + "'";

            label14.Text = d1.getString(query);

            // string itemPrice="select price from inventory where "
        }
コード例 #27
0
        private void comboBox4_TextChanged(object sender, EventArgs e)
        {
            databaseAccess d1 = new databaseAccess();

            string query = "select contactNumber from supplier where supplierName='" + comboBox4.Text + "'";

            textBox4.Text = d1.getString(query);
            string query2 = "select SupID  from supplier where supplierName='" + comboBox4.Text + "'";

            string supID  = d1.getString(query2);
            string query3 = "select * from  purchasepayments where SupplierID='" + supID + "'";

            d1.displayData(query3, dataGridView2);
        }
コード例 #28
0
ファイル: setting.cs プロジェクト: rochana-atapattu/product1
        private void button4_Click(object sender, EventArgs e)
        {
            databaseAccess d1     = new databaseAccess();
            string         query1 = "select count(*) from harasara.supplier where SupID='" + textBox6.Text + "'";

            if (0 == d1.getValue(query1))
            {
                string query = "insert into harasara.supplier (SupID,supplierName,contactNumber,Address,Bank,AccountNumber) values ('" + textBox6.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + richTextBox2.Text + "','" + comboBox2.Text + "','" + textBox7.Text + "')";


                d1.InsertData(query);
                CustomMsgBox.Show("Added New Supplier ", "OK");
            }
        }
コード例 #29
0
        //Cancel Order
        private void button7_Click(object sender, EventArgs e)
        {
            int    x      = dataGridView1.SelectedCells[0].RowIndex;
            int    ID     = Convert.ToInt32(label7.Text);
            string query  = "Delete from harasara.slorders where orderID='" + ID + "'";
            string query2 = "Delete from harasara.products where orderID='" + ID + "'";
            string query1 = "select * from harasara.slorders ";
            //string query1 = "Delete from harasara.products where ";
            databaseAccess d1 = new databaseAccess();

            d1.deleteData(query);
            d1.deleteData(query2);
            d1.displayData(query1, dataGridView1);
        }
コード例 #30
0
        //Insert customer provided order details in to the database
        public void getOrderdetails()
        {
            double sum     = 0;
            int    orderID = Convert.ToInt32(label20.Text);

            for (int i = 0; i < dataGridView2.Rows.Count; ++i)
            {
                sum += Convert.ToDouble(dataGridView2.Rows[i].Cells[4].Value);
            }
            string         query = "insert into harasara.slorders values ('" + orderID + "','" + textBox5.Text + "','" + label22.Text + "','" + sum + "','" + dateTimePicker1.Text + "')";
            databaseAccess d1    = new databaseAccess();

            d1.InsertData(query);
            label24.Text = sum.ToString();
        }