Пример #1
0
        public void GetNumber()
        {
            EmployeeHotel user    = new EmployeeHotel();
            WorkShift     w       = new WorkShift();
            double        manager = Convert.ToDouble(user.GetNumberOfManager());

            Getnum.Text = "Manager: " + manager.ToString();
        }
Пример #2
0
        public void ReturnRoleID()
        {
            DataTable     table    = this.ShowId();
            EmployeeHotel employee = new EmployeeHotel();

            Total = Convert.ToInt32(employee.GetNumberJanitor()) + Convert.ToInt32(employee.GetNumberOfManager()) + Convert.ToInt32(employee.GetNumberReceptionist());
            for (int i = 0; i < Total; i++)
            {
                arrayRole[i] = table.Rows[i]["role"].ToString().Trim();
                arrayID[i]   = Convert.ToInt32(table.Rows[i]["id"].ToString().Trim());
            }
        }
Пример #3
0
        public void ReLoad()
        {
            DataTable     table    = this.ShowId();
            EmployeeHotel employee = new EmployeeHotel();
            Random        random   = new Random();

            Total = Convert.ToInt32(employee.GetNumberJanitor()) + Convert.ToInt32(employee.GetNumberOfManager()) + Convert.ToInt32(employee.GetNumberReceptionist());
            this.ReturnRoleID();
            for (int i = 0; i < Total; i++)
            {
                int mon = random.Next(1, 4);
                int tue = random.Next(1, 4);
                int wed = random.Next(1, 4);
                int thu = random.Next(1, 4);
                int fri = random.Next(1, 4);
                this.UppdateShiftColumn1(arrayID[i], mon);
                this.UppdateShiftColumn2(arrayID[i], tue);
                this.UppdateShiftColumn3(arrayID[i], wed);
                this.UppdateShiftColumn4(arrayID[i], thu);
                this.UppdateShiftColumn5(arrayID[i], fri);
            }
        }
Пример #4
0
        public void GetShift()
        {
            this.ReturnRoleID();
            EmployeeHotel employee     = new EmployeeHotel();
            int           manager      = Convert.ToInt32(employee.GetNumberOfManager());
            int           receptionist = Convert.ToInt32(employee.GetNumberReceptionist());
            int           Janitor      = Convert.ToInt32(employee.GetNumberJanitor());

            //Monday
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Manager" && manager > 0)
                {
                    Check = 0;
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn1(arrayID[i], 1);
                    }
                    else
                    {
                        this.UppdateShiftColumn1(arrayID[i], s1);
                    }
                    Check = 1;
                }
            }
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Receptionist" && receptionist > 0)
                {
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn1(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Janitor" && Janitor > 0)
                {
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn1(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            //Tuesday
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Manager" && manager > 0)
                {
                    Check = 0;
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn2(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Receptionist" && receptionist > 0)
                {
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn2(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Janitor" && Janitor > 0)
                {
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn2(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }

            //Wednesday
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Manager" && manager > 0)
                {
                    Check = 0;
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn3(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Receptionist" && receptionist > 0)
                {
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn3(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Janitor" && Janitor > 0)
                {
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn3(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            //Thursday
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Manager" && manager > 0)
                {
                    Check = 0;
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn4(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Receptionist" && receptionist > 0)
                {
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn4(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Janitor" && Janitor > 0)
                {
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn4(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            //Friday
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Manager" && manager > 0)
                {
                    Check = 0;
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn5(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Receptionist" && receptionist > 0)
                {
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn5(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            for (int i = 0; i < Total; i++)
            {
                if (arrayRole[i] == "Janitor" && Janitor > 0)
                {
                    int s1 = random.Next(1, 4);
                    if (Check != s1)
                    {
                        this.UppdateShiftColumn5(arrayID[i], s1);
                    }
                    Check = s1;
                }
            }
            //for (int i = 0; i < Total; i++)
            //{
            //    int mon = random.Next(1, 4);
            //    int tue = random.Next(1, 4);
            //    int wed = random.Next(1, 4);
            //    int thu = random.Next(1, 4);
            //    int fri = random.Next(1, 4);
            //    int sat = random.Next(1, 4);
            //    int sun = random.Next(1, 4);
            //    this.UppdateShift(arrayID[i], mon, tue, wed, thu, fri, sat, sun);
            //}
        }
Пример #5
0
 public void RoleLogin()
 {
     try
     {
         if (Radio_Customer.Checked == true)
         {
             this.LoginWithCustomer();
         }
         else
         {
             string        role = "";
             EmployeeHotel user = new EmployeeHotel();
             user.ID       = Convert.ToInt32(Username_tb.Text);
             user.Password = Password_tb.Text;
             Database   data    = new Database();
             SqlCommand command = new SqlCommand("SELECT Id, password, fname, lname, CMND, bdate, address, phone, email, " +
                                                 "salary, role, daywork, work, picture, gender, shift FROM Employee WHERE Id = @id AND password = @pass", data.GetConnection);
             command.Parameters.Add("@id", SqlDbType.Int).Value        = Username_tb.Text;
             command.Parameters.Add("@pass", SqlDbType.NVarChar).Value = Password_tb.Text;
             data.OpenConnection();
             DataTable table = user.GetUsers(command);
             if (table.Rows.Count > 0)
             {
                 SqlDataAdapter SDA = new SqlDataAdapter();
                 SDA.SelectCommand = command;
                 DataSet set = new DataSet();
                 SDA.Fill(set, "Employee");
                 data.CloseConnection();
                 role = table.Rows[0]["role"].ToString().Trim();
                 int          UserId  = Convert.ToInt32(table.Rows[0]["id"].ToString());
                 byte[]       pic     = (byte[])table.Rows[0]["picture"];
                 MemoryStream picture = new MemoryStream(pic);
                 GetID(UserId);
                 WorkShift w = new WorkShift();
                 if (user.GetLogin() && role == "Manager" && Manager_rbt.Checked == true)
                 {
                     Menu manager = new Menu();
                     manager.Label_ShowId.Text = UserId.ToString();
                     manager.Label_wcome.Text  = "Wellcome back " + table.Rows[0]["fname"].ToString().Trim();
                     manager.PictureUser.Image = Image.FromStream(picture);
                     //w.InsertId(Convert.ToInt32(UserId));
                     manager.ShowDialog();
                 }
                 else if (user.GetLogin() && role == "Receptionist" && Receptionist_rbt.Checked == true)
                 {
                 }
                 else if (user.GetLogin() && role == "Janitor" && Janitor_rbt.Checked == true)
                 {
                 }
                 else
                 {
                     XtraMessageBox.Show("Invalid Username of wrong Password, Try again or Create new account", "Login", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
         }
     }
     catch
     {
         XtraMessageBox.Show("Invalid Username of wrong Password, Try again or Create new account", "Login", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }