Ejemplo n.º 1
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();
            }
        }