Пример #1
0
        private void BTNPromote_Click(object sender, RoutedEventArgs e)
        {
            TBikeDAL  MyDAL       = new TBikeDAL();
            DataTable ResultTable = MyDAL.SelectEmployeeByEmployeeID(LBEmployeeID.Text);

            Rank = Convert.ToInt32(ResultTable.Rows[0]["EmployeeRank"]);
            try
            {
                if (RankID > Rank)
                {
                    ConfirmWindow com = new ConfirmWindow(ImageType.Question, "Confirm?", "Are you sure to Promote " + LBEmployeeName.Text + " ?", "Yes", "No");
                    com.ShowDialog();
                    if (com.Confirmed)
                    {
                        MyDAL.UpdateEmployeePromotion(LBEmployeeID.Text, Rank + 1, TLUsername.Text);
                        ResultTable             = MyDAL.SelectEmployeeByEmployeeID(LBEmployeeID.Text);
                        LBEmployeeRankDesc.Text = Convert.ToString(ResultTable.Rows[0]["EmployeeRankDesc"]);
                    }
                }
                else
                {
                    ConfirmWindow com = new ConfirmWindow(ImageType.Error, "Error", "Cant Promote Rank Higher than self", "Ok", "Cancel");
                    com.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                PopWindow pop = new PopWindow(ImageType.Error, "Error", Convert.ToString(ex).Trim(), "OK");
                pop.ShowDialog();
            }
        }
Пример #2
0
        private async void BTNPromote_Click(object sender, RoutedEventArgs e)
        {
            if (id != null)
            {
                TBikeDAL MyDAL = new TBikeDAL();
                DataTable ResultTable = MyDAL.SelectEmployeeByEmployeeID(id);
                int Rank = Convert.ToInt32(ResultTable.Rows[0]["EmployeeRank"]);
                if (RankID >= 4 || self == username)
                {
                    if (self == username || RankID > Rank)
                        if (id != null)
                        {
                            EmployeeModify mod = new EmployeeModify();
                            mod.populateEmployee(id);
                            mod.PopulateDataFromLogin(username);
                            mod.Show();
                            this.Close();
                        }
                }
             
            }
            else
            {
                var res = await this.ShowMessageAsync("Error", "Please Select Employee");

            }
        }
Пример #3
0
        private void BTNUpdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                TBikeDAL MyDAL = new TBikeDAL();
                username = LBUsername.Text;
                ConfirmWindow com = new ConfirmWindow(ImageType.Error, "Update", "Are you sure to modify these changes?", "Yes", "No");
                com.ShowDialog();
                if (com.Confirmed)
                {
                    MyDAL.UpdateEmployee(LBEmployeeID.Text, LBEmployeeName.Text, Convert.ToDateTime(LBDob.Text), LBUsername.Text, LBEmployeeRankDesc.Text, LBEmail.Text, LBPhoneNo.Text, LBCity.Text, TLUsername.Text);
                    DataTable ResultTable = MyDAL.SelectEmployeeByEmployeeID(LBEmployeeID.Text);


                    LBEmployeeName.Text     = Convert.ToString(ResultTable.Rows[0]["EmployeeName"]).Trim();
                    LBEmployeeRankDesc.Text = Convert.ToString(ResultTable.Rows[0]["EmployeeRankDesc"]).Trim();
                    LBUsername.Text         = Convert.ToString(ResultTable.Rows[0]["Username"]).Trim();
                    LBEmail.Text            = Convert.ToString(ResultTable.Rows[0]["Email"]).Trim();
                    LBDob.Text       = Convert.ToString(ResultTable.Rows[0]["DateOfBirth"]).Trim();
                    LBPhoneNo.Text   = Convert.ToString(ResultTable.Rows[0]["PhoneNo"]).Trim();
                    LBCity.Text      = Convert.ToString(ResultTable.Rows[0]["Address"]).Trim();
                    LBLastLogin.Text = Convert.ToString(ResultTable.Rows[0]["LastLoginTime"]).Trim();

                    PopulateDataFromLogin(username);
                }
            }
            catch (Exception ex)
            {
                PopWindow pop = new PopWindow(ImageType.Error, "Error", ex.Message, "OK");
                pop.ShowDialog();
            }
        }
Пример #4
0
        public void populateEmployee(string EmployeeID)
        {
            TBikeDAL  MyDAL       = new TBikeDAL();
            DataTable ResultTable = MyDAL.SelectEmployeeByEmployeeID(EmployeeID);

            if (ResultTable.Rows.Count != 0)
            {
                LBEmployeeID.Text       = EmployeeID;
                LBEmployeeName.Text     = Convert.ToString(ResultTable.Rows[0]["EmployeeName"]).Trim();
                LBEmployeeRankDesc.Text = Convert.ToString(ResultTable.Rows[0]["EmployeeRankDesc"]).Trim();
                LBUsername.Text         = Convert.ToString(ResultTable.Rows[0]["Username"]).Trim();
                LBEmail.Text            = Convert.ToString(ResultTable.Rows[0]["Email"]).Trim();
                LBDob.Text       = Convert.ToString(ResultTable.Rows[0]["DateOfBirth"]).Trim();
                LBPhoneNo.Text   = Convert.ToString(ResultTable.Rows[0]["PhoneNo"]).Trim();
                LBCity.Text      = Convert.ToString(ResultTable.Rows[0]["Address"]).Trim();
                LBLastLogin.Text = Convert.ToString(ResultTable.Rows[0]["LastLoginTime"]).Trim();
            }
            else
            {
                PopWindow pop = new PopWindow(ImageType.Error, "Error", "No data Found!!!", "Ok");
                pop.ShowDialog();
            }
        }