private void insertBDClick(object sender, EventArgs e)
        {
            if (statusBox.Text == "Senior Employee")
            {
                if (passBox.Text == cpassBox.Text && nameBox.Text.Length != 0 && mailBox.Text.Contains("@") == true && contactBox.Text.Length != 0)
                {
                    rand       = r.Next(00000, 99999);
                    IdBox.Text = "se" + rand;

                    SeniorEmployeeRep ser = new SeniorEmployeeRep();

                    ser.SeniorEmployeename    = this.nameBox.Text;
                    ser.Gender                = this.sexBox.Text;
                    ser.SeniorEmployeeaddress = this.addBox.Text;
                    ser.Email            = this.mailBox.Text;
                    ser.Status           = this.statusBox.Text;
                    ser.Contacts         = this.contactBox.Text;
                    ser.Password         = this.passBox.Text;
                    ser.SeniorEmployeeid = this.IdBox.Text;
                    ser.Salary           = this.salaryBox.Text;

                    SeniorEmployeeRepositoryDB serdb = new SeniorEmployeeRepositoryDB();

                    if (serdb.Insert(ser))
                    {
                        MessageBox.Show("Insert Completed!", "Succeed");
                        //button7.Visible = true;
                    }

                    else
                    {
                        MessageBox.Show("Insert Not Complete", "Error");
                    }
                }

                else
                {
                    MessageBox.Show("Invalid!", "Error");
                }
            }


            else if (statusBox.Text == "Employee")
            {
                if (passBox.Text == cpassBox.Text && nameBox.Text.Length != 0 && mailBox.Text.Contains("@") == true && contactBox.Text.Length != 0)
                {
                    rand       = r.Next(00000, 99999);
                    IdBox.Text = "emp" + rand;

                    EmployeeRep er = new EmployeeRep();

                    er.Employeename = this.nameBox.Text;
                    er.Gender       = this.sexBox.Text;
                    er.Address      = this.addBox.Text;
                    er.Email        = this.mailBox.Text;
                    er.Status       = this.statusBox.Text;
                    er.Contacts     = this.contactBox.Text;
                    er.Password     = this.passBox.Text;
                    er.Employeeid   = this.IdBox.Text;
                    er.Salary       = this.salaryBox.Text;

                    EmployeeRepositoryDB erdb = new EmployeeRepositoryDB();

                    if (erdb.Insert(er))
                    {
                        MessageBox.Show("Insert Completed!", "Succeed");
                        //button7.Visible = true;
                    }

                    else
                    {
                        MessageBox.Show("Insert Not Complete", "Error");
                    }
                }

                else
                {
                    MessageBox.Show("Invalid!", "Error");
                }
            }

            else if (statusBox.Text == "Manufacturer")
            {
                if (passBox.Text == cpassBox.Text && nameBox.Text.Length != 0 && mailBox.Text.Contains("@") == true && contactBox.Text.Length != 0)
                {
                    rand       = r.Next(00000, 99999);
                    IdBox.Text = "man" + rand;

                    ManufacturerRep mr = new ManufacturerRep();

                    mr.Name = this.nameBox.Text;
                    //mr.Gender = this.sexBox.Text;
                    mr.Address  = this.addBox.Text;
                    mr.Email    = this.mailBox.Text;
                    mr.Status   = this.statusBox.Text;
                    mr.Contacts = this.contactBox.Text;
                    //mr.Password = this.passBox.Text;
                    mr.Id = this.IdBox.Text;
                    //mr.Salary = this.salaryBox.Text;

                    ManufacturerRepositoryDB mrdb = new ManufacturerRepositoryDB();

                    if (mrdb.Insert(mr))
                    {
                        MessageBox.Show("Insert Completed!", "Succeed");
                        //button7.Visible = true;
                    }

                    else
                    {
                        MessageBox.Show("Insert Not Complete", "Error");
                    }
                }

                else
                {
                    MessageBox.Show("Invalid!", "Error");
                }
            }
        }
 public EmployeeController()
 {
     mapperEmployee = new MapperEmployee();
     repEmployee    = new EmployeeRep();
 }
 public EmployeeSvc()
 {
     employeeRep = new EmployeeRep();
 }
Example #4
0
        private void signin_click(object sender, EventArgs e)
        {
            /*LoginRep lr = new LoginRep();
             * lr.ID = this.idBox.Text;
             * lr.Pass = this.passBox.Text;
             *
             * LoginRepositoryDB lRepDB = new LoginRepositoryDB();
             *
             * if (lRepDB.UserLoginVerification(lr))
             * {
             *  string n = lr.Name;
             *  string s = lr.Status;
             *  string id = lr.ID;
             *  Console.WriteLine(n + "  " + s);
             *
             *  SeniorEmployee se = new SeniorEmployee(s, n, id);
             *  //SeniorEmployee se = new SeniorEmployee(n, s);
             *  se.Show();
             *  this.Hide();
             *
             *
             * }
             *
             * else
             * {
             *  MessageBox.Show("Not Found", "Error");
             * }*/

            if (this.idBox.Text.Contains("se") == true)
            {
                //MessageBox.Show("hello!");
                SeniorEmployeeRep ser = new SeniorEmployeeRep();
                ser.SeniorEmployeeid = this.idBox.Text;
                ser.Password         = this.passBox.Text;

                SeniorEmployeeRepositoryDB serdb = new SeniorEmployeeRepositoryDB();

                if (serdb.UserLoginVerification(ser))
                {
                    string n   = ser.SeniorEmployeename;
                    string g   = ser.Gender;
                    string id  = ser.SeniorEmployeeid;
                    string add = ser.SeniorEmployeeaddress;
                    string m   = ser.Email;
                    string p   = ser.Password;
                    string c   = ser.Contacts;
                    string s   = ser.Status;

                    Console.WriteLine(n + "  " + s);

                    SeniorEmployee se = new SeniorEmployee(n, g, id, add, m, p, c, s);
                    //SeniorEmployee se = new SeniorEmployee(n, s);
                    se.Show();
                    this.Hide();
                }

                else
                {
                    MessageBox.Show("Not Found!!", "Error");
                }
            }

            else if (this.idBox.Text.Contains("emp") == true)
            {
                //MessageBox.Show("hello!");
                EmployeeRep er = new EmployeeRep();
                er.Employeeid = this.idBox.Text;
                er.Password   = this.passBox.Text;

                EmployeeRepositoryDB erdb = new EmployeeRepositoryDB();

                if (erdb.UserLoginVerification(er))
                {
                    string n   = er.Employeename;
                    string g   = er.Gender;
                    string id  = er.Employeeid;
                    string add = er.Address;
                    string m   = er.Email;
                    string p   = er.Password;
                    string c   = er.Contacts;
                    string s   = er.Status;

                    Console.WriteLine(n + "  " + s);

                    //SeniorEmployee se = new SeniorEmployee(n, g, id, add, m, p, c, s);
                    //SeniorEmployee se = new SeniorEmployee(n, s);
                    Employee emp = new Employee(n, g, id, add, m, p, c, s);
                    emp.Show();
                    this.Hide();
                }

                else
                {
                    MessageBox.Show("Not Found!!", "Error");
                }
            }

            else
            {
                MessageBox.Show("Invalid UserID or Password!!", "Error");
            }
        }