public static DialogResult Show(string Text, string btnYes)
        {
            MsgBox = new CustomMsgBox();
            MsgBox.MsgBoxLabel.Text = Text;
            MsgBox.Yesbtn.Text      = btnYes;

            MsgBox.ShowDialog();
            return(result);
        }
        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");
        }
Example #3
0
 private void Pay1_Click(object sender, EventArgs e)
 {
     if (label20.Text == "XXXXXX")
     {
         CustomMsgBox.Show("Your Order Is Not Successfully Processed", "OK");
     }
     else
     {
         Bill b1 = new Bill(textBox5.Text, textBox7.Text, richTextBox1.Text, textBox6.Text, label20.Text, label24.Text, label22.Text, 1);
         b1.Show();
     }
 }
Example #4
0
        private void button4_Click(object sender, EventArgs e)
        {
            CustomMsgBox.Show("  Completed ", "OK");

            textBox6.Text     = null;
            textBox1.Text     = null;
            textBox2.Text     = null;
            richTextBox2.Text = null;
            comboBox1.Text    = null;
            comboBox2.Text    = null;
            textBox7.Text     = null;
            label10.Text      = "XXXXXXX";
        }
Example #5
0
        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");
            }
        }
Example #6
0
        public int getValue(string query)
        {
            con.Open();

            try
            {
                cmd             = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = query;
                int x = Convert.ToInt32(cmd.ExecuteScalar());
                con.Close();
                return(x);
            }
            catch (Exception ex)
            {
                CustomMsgBox.Show(ex.Message, "OK");
                con.Close();
                return(0);
            }
        }
Example #7
0
        public string getString(string query)
        {
            con.Open();

            try
            {
                cmd             = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = query;
                string x = cmd.ExecuteScalar().ToString();
                con.Close();
                return(x);
            }
            catch (Exception ex)
            {
                string charc = " ";
                CustomMsgBox.Show(ex.Message, "OK");
                con.Close();
                return(charc);
            }
        }
Example #8
0
        private void PayB_Click(object sender, EventArgs e)
        {
            if (label7.Text == "SupplierID")
            {
                databaseAccess d2 = new databaseAccess();

                string pID = "PU" + invoiceBill.Text + label2.Text;

                if (pType == "Cash")
                {
                    string query = "insert into purchasepayments values('" + pID + "','" + label8.Text + "','" + DateTime.Now.Date.ToString("yyyy-MM-dd") + ",,'" + pType + "','" + label2.Text + "','" + label1.Text + "','" + emailBill.Text + "')";
                    d2.InsertData(query);
                }
                else if (pType == "Credit")
                {
                    string query = "insert into purchasepayments values('" + pID + "','" + label8.Text + "','" + DateTime.Now.Date.ToString("yyyy-MM-dd") + ",,'" + pType + "','" + label2.Text + "','" + label1.Text + "','" + emailBill.Text + "')";
                    d2.InsertData(query);
                }
            }
            else
            {
                databaseAccess d1  = new databaseAccess();
                string         pID = "SL" + invoiceBill.Text + label2.Text;

                if (pType == "Cash")
                {
                    string query = "insert into harasara.payments(PaymentID,customerID,date,type,CardNumber,orderID,Price) values('" + pID + "','" + label8.Text + "','" + DateTime.Now.Date.ToString("yyyy-MM-dd") + "','" + pType + "','" + textBox1.Text + "','" + label2.Text + "','" + Convert.ToDouble(label1.Text) + "') ";
                    d1.InsertData(query);
                }
                else if (pType == "Credit")
                {
                    string query = "insert into harasara.payments(PaymentID,customerID,date,type,CardNumber,orderID,Price) values('" + pID + "','" + label8.Text + "','" + DateTime.Now.Date.ToString("yyyy-MM-dd") + "','" + pType + "','" + textBox1.Text + "','" + label2.Text + "','" + Convert.ToDouble(label1.Text) + "') ";
                    d1.InsertData(query);
                }

                string dlQuery = "Delete from harasara.slorders where orderID='" + label2.Text + "'";
                d1.deleterow(dlQuery);
                CustomMsgBox.Show("Payment was successfull", "OK");
            }
        }
Example #9
0
        public void contactNumberValidation(string text, Label label)
        {
            try
            {
                Regex rx = new Regex(@"^(\+[0-9]{9})$");
                bool  x  = rx.IsMatch(text);

                if (x == true)
                {
                    label.Text = "        ";
                }
                else
                {
                    label.ForeColor = Color.Red;
                    label.Text      = " Invalid Contact Number ";
                }
            }
            catch (Exception ex)
            {
                CustomMsgBox.Show(ex.Message, "OK");
            }
        }
Example #10
0
        //Insert new Customer Details in to database
        public void getCustomerDetails()
        {
            //con.Open();

            try {
                string customer = textBox5.Text;
                string number   = textBox7.Text;
                string email    = textBox6.Text;
                string address  = richTextBox1.Text;



                cmd             = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "insert into harasara.customer (customerName,contactNumber,Address,Email) values('" + customer + "','" + number + "','" + address + "','" + email + "')";
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                CustomMsgBox.Show(ex.Message, "OK");
            }
            //con.Close();
        }