Esempio n. 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();
            }
        }