Exemplo n.º 1
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

        public void reload()
        {
            Billingform bf = new Billingform(user_name, log);

            bf.Show();
            this.Close();
        }
Exemplo n.º 2
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {

            User UPName = new User();
            UPName.GetUsername = UserName.Text;
            UPName.GetPassword = maskedTextBox1.Text;

            if (UserName.Text != " ")
            {
                if (UPName.UsernameAuthenticaion())
                {
                    if (maskedTextBox1.Text != " ")
                    {
                        if (UPName.PasswordAuthenticaion())
                        {
                            if (UPName.UserCatagory() == "Admin")
                            {
                                Admin AdminForm = new Admin(this);
                                AdminForm.Show();
                                this.Hide();

                                UserName.Text = "UserName";
                                maskedTextBox1.Text = "Password";
                                UserName.ForeColor = Color.Gray;
                                maskedTextBox1.ForeColor = Color.Gray;
                                maskedTextBox1.PasswordChar = '\0';
                            }
                            else if (UPName.UserCatagory() == "User")
                            {
                                Billingform Bill = new Billingform(UPName.GetUsername, this);
                                Bill.Show();
                                this.Hide();

                                UserName.Text = "UserName";
                                maskedTextBox1.Text = "Password";
                            }
                        }
                        else
                        {
                            MessageBox.Show("Please Enter CORRECT Password");
                        }
                    }
                    else
                    {
                        MessageBox.Show("password is Empty");
                    }
                }
                else
                {
                    MessageBox.Show("Please Enter CORRECT Username");
                }
            }
            else
            {
                MessageBox.Show("Username is Empty");
            }


        }
Exemplo n.º 3
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            User UPName = new User();

            UPName.GetUsername = UserName.Text;
            UPName.GetPassword = maskedTextBox1.Text;

            if (UserName.Text != " ")
            {
                if (UPName.UsernameAuthenticaion())
                {
                    if (maskedTextBox1.Text != " ")
                    {
                        if (UPName.PasswordAuthenticaion())
                        {
                            if (UPName.UserCatagory() == "Admin")
                            {
                                Admin AdminForm = new Admin(this);
                                AdminForm.Show();
                                this.Hide();

                                UserName.Text               = "UserName";
                                maskedTextBox1.Text         = "Password";
                                UserName.ForeColor          = Color.Gray;
                                maskedTextBox1.ForeColor    = Color.Gray;
                                maskedTextBox1.PasswordChar = '\0';
                            }
                            else if (UPName.UserCatagory() == "User")
                            {
                                Billingform Bill = new Billingform(UPName.GetUsername, this);
                                Bill.Show();
                                this.Hide();

                                UserName.Text       = "UserName";
                                maskedTextBox1.Text = "Password";
                            }
                        }
                        else
                        {
                            MessageBox.Show("Please Enter CORRECT Password");
                        }
                    }
                    else
                    {
                        MessageBox.Show("password is Empty");
                    }
                }
                else
                {
                    MessageBox.Show("Please Enter CORRECT Username");
                }
            }
            else
            {
                MessageBox.Show("Username is Empty");
            }
        }
Exemplo n.º 4
0
        private void Form6_Load(object sender, EventArgs e)
        {
            Billingform bf = (Billingform)frm;

            txtBoxCode.Text = bf.dataGridView1.Rows[bf.dataGridView1.CurrentCell.RowIndex].Cells[1].Value.ToString();             //load code to form6 from dgv

            txtBoxDescription.Text = bf.dataGridView1.Rows[bf.dataGridView1.CurrentCell.RowIndex].Cells[2].Value.ToString();      //description

            textBox10.Text = bf.dataGridView1.Rows[bf.dataGridView1.CurrentCell.RowIndex].Cells[3].Value.ToString();              //quantity

            textBox8.Text = bf.dataGridView1.Rows[bf.dataGridView1.CurrentCell.RowIndex].Cells[5].Value.ToString();               //rate
        }
Exemplo n.º 5
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

        public void reload()
        {
            Billingform bf = new Billingform(user_name,log);
            bf.Show();
            this.Close();
        }
Exemplo n.º 6
0
        private void button5_Click(object sender, EventArgs e)
        {
            decimal total;


            decimal quantity;

            Decimal.TryParse(textBox10.Text, out quantity);



            Billingform bf = (Billingform)frm;


            try
            {
                if (txtBoxDiscount.Text != "")
                {
                    decimal discount_Price;

                    Decimal.TryParse(txtBoxDiscount.Text + ".00", out discount_Price);



                    total = (quantity * discount_Price);                  //calculate total when discount price is entered



                    bf.dataGridView1.Rows[bf.dataGridView1.CurrentCell.RowIndex].Cells[6].Value = total; //total



                    //...........................update total,qty & discount

                    decimal sum = 0;

                    int qty = 0;

                    decimal discount = 0;



                    for (int i = 0; i < bf.dataGridView1.Rows.Count; i++)
                    {
                        sum += Convert.ToDecimal(bf.dataGridView1.Rows[i].Cells[6].Value);

                        qty += Convert.ToInt32(bf.dataGridView1.Rows[i].Cells[3].Value);

                        discount += Convert.ToDecimal(bf.dataGridView1.Rows[i].Cells[4].Value);
                    }

                    bf.label7.Text = sum.ToString();

                    bf.label2.Text = qty.ToString();

                    bf.label4.Text = discount.ToString();



                    this.Close();
                }



                else if (textBox1.Text != " ")
                {
                    decimal presentage;

                    Decimal.TryParse(textBox1.Text, out presentage);



                    if ((presentage > 0 && presentage <= 100))
                    {
                        decimal price;

                        Decimal.TryParse(textBox8.Text, out price);


                        decimal discount;


                        discount = (price * (presentage / 100));                  //calculate discount when presentage is entered


                        total = (quantity * (price - discount));                             //calculate total



                        bf.dataGridView1.Rows[bf.dataGridView1.CurrentCell.RowIndex].Cells[4].Value = discount;          //discount


                        bf.dataGridView1.Rows[bf.dataGridView1.CurrentCell.RowIndex].Cells[6].Value = total;               //total



                        // ..............................................................update labels



                        decimal sum = 0;

                        int qty = 0;

                        decimal discount1 = 0;


                        for (int i = 0; i < bf.dataGridView1.Rows.Count; i++)
                        {
                            sum += Convert.ToDecimal(bf.dataGridView1.Rows[i].Cells[6].Value);

                            qty += Convert.ToInt32(bf.dataGridView1.Rows[i].Cells[3].Value);

                            discount1 += Convert.ToDecimal(bf.dataGridView1.Rows[i].Cells[4].Value);
                        }

                        bf.label7.Text = sum.ToString();

                        bf.label2.Text = qty.ToString();

                        bf.label4.Text = discount1.ToString();



                        this.Close();
                    }


                    else
                    {
                        MessageBox.Show("Precentage is out of Range");
                    }
                }



                else if (textBox1.Text != " " && txtBoxDiscount.Text != "")
                {
                    MessageBox.Show("Both Discount Presentage and Discount Price can't be filled");
                }



                else
                {
                    MessageBox.Show("Discount Presentage or Discount Price Must be Enter");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Please Try Again" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            finally
            {
                BillGeneration bill = new BillGeneration();
                bill.total(frm);
            }
        }
Exemplo n.º 7
0
 public Form6(object obj)
 {
     InitializeComponent();
     frm = obj;
     Billingform bf = (Billingform)frm;
 }