Esempio n. 1
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            String s       = "Salesman";
            String a       = "All employee";
            String pList   = "Product";
            String section = comboBox2.Text;

            pd = new ShopQDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\USER\Documents\Informatio.mdf;Integrated Security=True;Connect Timeout=30");
            ProductList p = new ProductList();

            if (section.Equals(pList))
            {
                var x = from Barcode in pd.ProductLists select Barcode;

                dataGridView1.DataSource = x;
            }
            else if (section.Equals(s))
            {
                var x = from Id in pd.Salesmans select Id;

                dataGridView1.DataSource = x;
            }
            else if (section.Equals(a))
            {
                MessageBox.Show("uncomplete due to lact of Time !!");

                //var x = from UserId in pd.Employes select UserId;

                //dataGridView1.DataSource = x;
            }
            else
            {
                MessageBox.Show("Selec section first !!");
            }
        }
        public AutoCompleteStringCollection ClientListDropDown()
        {
            AutoCompleteStringCollection auto = new AutoCompleteStringCollection();

            pd = new ShopQDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\USER\Documents\Informatio.mdf;Integrated Security=True;Connect Timeout=30");

            return(auto);
        }
        private void valueChanged(object sender, DataGridViewCellEventArgs e)
        {
            pd = new ShopQDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\USER\Documents\Informatio.mdf;Integrated Security=True;Connect Timeout=30");

            String newvalu;

            newvalu = this.dataGridView1.Rows[0].Cells[1].Value.ToString();
            // int a = int.Parse(newvalu);
            var x = from Rate in pd.ProductLists
                    where Rate.Barcode == int.Parse(newvalu)
                    select Rate;

            dataGridView1.DataSource = x;
        }
        private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            pd = new ShopQDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\USER\Documents\Informatio.mdf;Integrated Security=True;Connect Timeout=30");
            if (e.ColumnIndex == 0)
            {
                String newvalu;
                newvalu = this.dataGridView1.Rows[0].Cells[1].Value.ToString();
                // int a = int.Parse(newvalu);
                var x = from Rate in pd.ProductLists
                        where Rate.Barcode == int.Parse(newvalu)
                        select Rate;
                dataGridView1.DataSource = x;
            }

            //multiplication
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                row.Cells[dataGridView1.Columns[4].Index].Value = (Convert.ToDouble(row.Cells[dataGridView1.Columns[2].Index].Value) * Convert.ToDouble(row.Cells[dataGridView1.Columns[3].Index].Value));
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 a = new Form2();

            //AdminForm a = new AdminForm();
            a.ShowDialog();
            pd = new ShopQDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\USER\Documents\Informatio.mdf;Integrated Security=True;Connect Timeout=30");

            String username = textBox1.Text;
            String password = textBox2.Text;

            if (username == "")
            {
                MessageBox.Show("UserName must be filled ! ");
            }
            else if (password == "")
            {
                MessageBox.Show("Password must be filled ! ");
            }
            else
            {
                var x = from UserId in pd.Employes
                        where UserId.Name == username && UserId.Password == password
                        select UserId;

                if (x.Count() != 1)
                {
                    MessageBox.Show("Account not Found !");
                }
                else
                {
                    this.Hide();
                    //MessageBox.Show("Succesfully Logged in !");
                    Form2 r = new Form2();
                    r.ShowDialog();
                }
            }
        }
Esempio n. 6
0
        private void AdminForm_Load(object sender, EventArgs e)
        {
            String s       = "Salesman";
            String a       = "All employee";
            String pList   = "Product";
            String section = comboBox2.Text;

            pd = new ShopQDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\USER\Documents\Informatio.mdf;Integrated Security=True;Connect Timeout=30");
            ProductList p = new ProductList();

            if (section.Equals(pList))
            {
                var x = from Barcode in pd.ProductLists select Barcode;

                dataGridView1.DataSource = x;
                //comboBox2.DataSource = x.Distinct();
                //var y = from  Barcode in pd.ProductLists select Barcode;
                // comboBox1.DataSource = y.Distinct();
                //comboBox1.DisplayMember = "Product Name";
            }
            else if (section.Equals(s))
            {
                var x = from Id in pd.Salesmans select Id;

                dataGridView1.DataSource = x;
            }
            else if (section.Equals(a))
            {
                var x = from Barcode in pd.Employes select Barcode;

                dataGridView1.DataSource = x;
            }
            else
            {
                MessageBox.Show("Selec section first !!");
            }
        }
Esempio n. 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            pd = new ShopQDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\USER\Documents\Informatio.mdf;Integrated Security=True;Connect Timeout=30");

            String Name      = textBox2.Text;
            String Email     = textBox1.Text;
            String Password  = textBox3.Text;
            String Cpassword = textBox4.Text;
            String Gender    = comboBox2.Text;

            String Number  = textBox5.Text;
            String Address = textBox6.Text;
            String Role    = comboBox1.Text;


            if (Name == "")
            {
                MessageBox.Show("Name field is empty");
            }


            else if (Email == "")
            {
                MessageBox.Show("Email field is empty");
            }
            else if (Password == "")
            {
                MessageBox.Show("Password field is empty");
            }
            else if (Password != Cpassword)
            {
                MessageBox.Show("pasword doesnt match");
            }
            else if (Number == "")
            {
                MessageBox.Show("Number field is empty");
            }
            else if (Address == "")
            {
                MessageBox.Show("Address field is empty");
            }
            else if (Role == "")
            {
                MessageBox.Show("Select Role");
            }
            else
            {
                Employe pr = new Employe()
                {
                    Name         = textBox2.Text,
                    Email        = textBox1.Text,
                    Password     = Cpassword,
                    Gender       = Gender,
                    Phone_Number = int.Parse(Number),
                    Address      = Address,
                    Job          = Role
                };


                pd.Employes.InsertOnSubmit(pr);
                pd.SubmitChanges();
            }
        }