private void button2_Click(object sender, EventArgs e)
        {
            int       pID    = Convert.ToInt32(comboBox2.SelectedValue);
            string    Error  = "";
            DBProduct Obj    = new DBProduct();
            double    PCount = Obj.geProductQuantityCount(pID, ref Error);
            double    qun    = Convert.ToInt64(textBox2.Text);

            if (qun < PCount)
            {
                con.Open();
                string         query = "INSERT INTO SalesInfo (CategoryName,PtName,SQuantity,Price,Date) VALUES ('" + comboBox1.Text + "','" + comboBox2.Text + "','" + textBox2.Text + "','" + comboBox3.Text + "', '" + dateTimePicker1.Value.Date + "')";
                SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                sda.SelectCommand.ExecuteNonQuery();
                con.Close();
                MessageBox.Show("Sell Submitted !");
            }
            else
            {
                MessageBox.Show("Quantity exceeded the available limit in stock !!");
                MessageBox.Show("Available Quantity of the selected product : " + Convert.ToString(PCount));
            }
            textBox2.Clear();
            textBox3.Clear();
        }
Exemple #2
0
        private void fillStatus()
        {
            string    Error = "";
            DBProduct Obj   = new DBProduct();
            DataTable table = Obj.getAllStatus(ref Error);

            comboBox3.DataSource    = table;
            comboBox3.DisplayMember = "ProblemSolved";
            comboBox3.ValueMember   = "SlvId";
        }
Exemple #3
0
        private void fillCategory()
        {
            string    Error = "";
            DBProduct Obj   = new DBProduct();
            DataTable table = Obj.getAllCategory(ref Error);

            comboBox1.DataSource    = table;
            comboBox1.DisplayMember = "CategoryName";
            comboBox1.ValueMember   = "CategoryId";
        }
        private void ShowSell_Load(object sender, EventArgs e)
        {
            string    Error = "";
            DBProduct obj   = new DBProduct();
            DataTable table = obj.getAllSellsData(ref Error);

            if (Error != "")
            {
                MessageBox.Show(Error);
            }
            else
            {
                dataGridView1.DataSource = table;
            }
        }