private void staffMenu_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            StaffManagement staffManagement = new StaffManagement();

            staffManagement.Show();
            Hide();
        }
        public IHttpActionResult PutStaffManagement(string id, StaffManagement staffManagement)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != staffManagement.StaffID)
            {
                return(BadRequest());
            }

            db.Entry(staffManagement).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StaffManagementExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        private void StaffMenu_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            StaffManagement staffManagement = new StaffManagement();

            staffManagement.Show();
            Hide();
        }
        public IHttpActionResult PostStaffManagement(StaffManagement staffManagement)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.StaffManagements.Add(staffManagement);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (StaffManagementExists(staffManagement.StaffID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = staffManagement.StaffID }, staffManagement));
        }
Esempio n. 5
0
        public ActionResult DeleteConfirmed(string id)
        {
            StaffManagement staffManagement = db.StaffManagements.Find(id);

            db.StaffManagements.Remove(staffManagement);
            db.SaveChanges();
            return(RedirectToAction("StaffManagement", "Home"));
        }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "StaffID,StaffName,DateOfBirth,BankAccountNumber,MailingAddress,PhoneNumber,DutyTypes")] StaffManagement staffManagement)
 {
     if (ModelState.IsValid)
     {
         db.Entry(staffManagement).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("StaffManagement", "Home"));
     }
     return(View(staffManagement));
 }
        public IHttpActionResult GetStaffManagement(string id)
        {
            StaffManagement staffManagement = db.StaffManagements.Find(id);

            if (staffManagement == null)
            {
                return(NotFound());
            }

            return(Ok(staffManagement));
        }
        public void clearTextTeacher()
        {
            //arrange
            StaffManagement sm = new StaffManagement();


            //act
            Boolean t = sm.clearText();

            //assert
            Assert.AreEqual(true, t);
        }
        public IHttpActionResult DeleteStaffManagement(string id)
        {
            StaffManagement staffManagement = db.StaffManagements.Find(id);

            if (staffManagement == null)
            {
                return(NotFound());
            }

            db.StaffManagements.Remove(staffManagement);
            db.SaveChanges();

            return(Ok(staffManagement));
        }
Esempio n. 10
0
        // GET: StaffManagements/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StaffManagement staffManagement = db.StaffManagements.Find(id);

            if (staffManagement == null)
            {
                return(HttpNotFound());
            }
            return(View(staffManagement));
        }
        public void deleteTeacher()
        {
            //arrange
            StaffManagement sm = new StaffManagement();


            //act
            string full_name = "Juel Hossain";


            Boolean t = sm.delete(full_name);

            //assert
            Assert.AreEqual(true, t);
        }
Esempio n. 12
0
        private void enter(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (Char)Keys.Enter)
            {
                if (string.IsNullOrEmpty(txtKullaniciAdi.Text))
                {
                    errorProvider1.SetError(txtKullaniciAdi, "Kullanıcı Ad Girişi Yapmadınız");
                }
                if (string.IsNullOrEmpty(txtSifre.Text))
                {
                    errorProvider1.SetError(txtSifre, "Şifre Girişi Yapmadınız");
                }
                else
                {
                    errorProvider1.Clear();
                    StaffManagement um = new StaffManagement();

                    StaffState state = um.GetUser(txtKullaniciAdi.Text, txtSifre.Text);
                    switch (state)
                    {
                    case StaffState.UserNotExists:
                        MessageBox.Show("Kullanıcı Adınız veya Şifreniz Hatalı");
                        break;

                    case StaffState.PasswordWrong:
                        MessageBox.Show("Şifreniz Hatalı");
                        break;

                    case StaffState.UsernameWrong:
                        MessageBox.Show("Kullancı Adınız Hatalı");
                        break;

                    case StaffState.UserExists:

                        Staff personel           = um.GetUserr(txtKullaniciAdi.Text, txtSifre.Text);
                        StaffOrientationForm stf = new StaffOrientationForm(personel);
                        stf.Show();
                        this.Hide();
                        break;

                    default:
                        MessageBox.Show("Böyle Bir Kullanıcı Bulunamadı");
                        break;
                    }
                }
            }
        }
        public void updateTeacher()
        {
            //arrange
            StaffManagement sm = new StaffManagement();


            //act
            string full_name    = "aaaa";
            string address      = "india";
            string phone_number = "999767676";
            string email        = "*****@*****.**";
            string role         = "Head Master";
            string dob          = "20-12-1961";
            string sex          = "Male";
            string jsy          = "2007";

            Boolean t = sm.update(full_name, address, phone_number, email, role, dob, sex, jsy);

            //assert
            Assert.AreEqual(true, t);
        }
Esempio n. 14
0
        private void StaffManagement_Click(object sender, EventArgs e)
        {
            StaffManagement staff = new StaffManagement();

            staff.ShowDialog();
        }
Esempio n. 15
0
        private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            UserControl usc          = null;
            bool        isAuthorized = false;

            if (ListViewMenu.SelectedIndex == -1)
            {
                return;
            }
            switch (((ListViewItem)((ListView)sender).SelectedItem).Name)
            {
            case "Book":
                if (FeatureAttributeService.isAuthorized(typeof(BookManagementControl)))
                {
                    if (!isShowed(typeof(BookManagementControl)))
                    {
                        usc = new BookManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Customer":
                if (FeatureAttributeService.isAuthorized(typeof(MemberManagement)))
                {
                    if (!isShowed(typeof(MemberManagement)))
                    {
                        usc = new MemberManagement();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Staff":
                if (FeatureAttributeService.isAuthorized(typeof(StaffManagement)))
                {
                    if (!isShowed(typeof(StaffManagement)))
                    {
                        usc = new StaffManagement();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Provider":
                if (FeatureAttributeService.isAuthorized(typeof(ProviderManagementControl)))
                {
                    if (!isShowed(typeof(ProviderManagementControl)))
                    {
                        usc = new ProviderManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Publisher":
                if (FeatureAttributeService.isAuthorized(typeof(PublisherManagementControl)))
                {
                    if (!isShowed(typeof(PublisherManagementControl)))
                    {
                        usc = new PublisherManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Category":
                if (FeatureAttributeService.isAuthorized(typeof(CategoryManagementControl)))
                {
                    if (!isShowed(typeof(CategoryManagementControl)))
                    {
                        usc = new CategoryManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Author":
                if (FeatureAttributeService.isAuthorized(typeof(AuthorManagementControl)))
                {
                    if (!isShowed(typeof(AuthorManagementControl)))
                    {
                        usc = new AuthorManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Transaction":
                if (FeatureAttributeService.isAuthorized(typeof(TransactionManagementControl)))
                {
                    if (!isShowed(typeof(TransactionManagementControl)))
                    {
                        usc = new TransactionManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            default:
                break;
            }
            if (!isAuthorized)
            {
                MessageBox.Show("You are not authorized for this feature!");
            }
            ListViewMenu.SelectedIndex = -1;
        }
Esempio n. 16
0
        protected void AddNewStaff(object sender, EventArgs e)
        {

            var environmentParametersViewModel = new EnvironmentParametersFactory(AppSettings.ConnectionStringName).GetEnvironmentParameters();
            var staffManagement = new StaffManagement(environmentParametersViewModel);

            var doesUserExist = staffManagement.DoesUserExist(loginID.Text);
            staffManagement.Dispose();

            if (doesUserExist)
            {
                var radalertscript = "<script language='javascript'>function f(){radalert('" + string.Format("Cannot Add User, this user already exists.  User: {0}", loginID.Text) + "', 300, 300, 'Duplicate User Detected'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
                Page.ClientScript.RegisterStartupScript(GetType(), "radalert", radalertscript); 
                return;
            }

            var staffIdentificationTable = new dtGeneric_String_String();
            var schoolIdTable = new dtGeneric_Int();
            var userTypeIdTable = new dtGeneric_String();
            string restrictionsValue = string.Empty ;

            staffIdentificationTable.Rows.Add("FirstName", firstName.Text);
            staffIdentificationTable.Rows.Add("MiddleName", middleName.Text);
            staffIdentificationTable.Rows.Add("LastName", lastName.Text);
            staffIdentificationTable.Rows.Add("Email", email.Text);
            staffIdentificationTable.Rows.Add("LoginID", loginID.Text);
            
            switch (DataIntegrity.ConvertToInt(restrictionsDropdown.SelectedIndex))     // using index is not best way to accomplish this... but easy to fix in the future if we need to reorder dropdown
            {
                case (int)Restrictions.None:
                    staffIdentificationTable.Rows.Add("IsLockedOut", "false");
                    staffIdentificationTable.Rows.Add("IsApproved", "true");
                    staffIdentificationTable.Rows.Add("Restrictions", "None");
                    restrictionsValue = "None";
                    break;
                case (int)Restrictions.Revoked:
                    staffIdentificationTable.Rows.Add("IsLockedOut", "false");
                    staffIdentificationTable.Rows.Add("IsApproved", "false");
                    staffIdentificationTable.Rows.Add("Restrictions", "None");
                    restrictionsValue = "None";
                    break;
                case (int)Restrictions.LockedOut:
                    staffIdentificationTable.Rows.Add("IsLockedOut", "true");
                    staffIdentificationTable.Rows.Add("IsApproved", "true");
                    staffIdentificationTable.Rows.Add("Restrictions", "None");
                    restrictionsValue = "None";
                    break;
                case (int)Restrictions.ChangePassword:
                    staffIdentificationTable.Rows.Add("IsLockedOut", "false");
                    staffIdentificationTable.Rows.Add("IsApproved", "true");
                    staffIdentificationTable.Rows.Add("Restrictions", ThinkgateUser.ChangePasswordRestrictionValue);
                    restrictionsValue = ThinkgateUser.ChangePasswordRestrictionValue.ToString(CultureInfo.InvariantCulture);
                    break;
            }
            foreach (RadComboBoxItem item in schoolDropdown.Items)
            {
                var itemCheckbox = (CheckBox)item.FindControl("schoolCheckbox");
                var itemLabel = (Label)item.FindControl("schoolLabel");

                if (itemCheckbox != null && itemCheckbox.Checked && itemLabel.Text != @"All" && itemLabel.Text.ToLower().IndexOf("<img", StringComparison.Ordinal) == -1)
                {
                    schoolIdTable.Add(DataIntegrity.ConvertToInt(item.Value));
                }
            }
			StringBuilder userSyncRoles = new StringBuilder();
            foreach (RadComboBoxItem item in userTypeDropdown.Items)
            {
                var itemCheckbox = (CheckBox)item.FindControl("userTypeCheckbox");
                var itemLabel = (Label)item.FindControl("userTypeLabel");

                if (itemCheckbox != null && itemCheckbox.Checked && itemLabel.Text != @"All" && itemLabel.Text.ToLower().IndexOf("<img", StringComparison.Ordinal) == -1)
                {
                    userTypeIdTable.Add(item.Text);
					userSyncRoles.Append(itemLabel.Text);
                }
            }

            /*  Create the user record  */
            /* Validate Results - if error, give message and go back to user */
            SqlParameterCollection parms = new SqlCommand().Parameters;
            parms.AddWithValue("ApplicationName", AppSettings.ApplicationName);
            parms.AddWithValue("UserName", loginID.Text);
            parms.AddWithValue("FirstName", firstName.Text);
            parms.AddWithValue("MiddleName", middleName.Text);
            parms.AddWithValue("LastName", lastName.Text);
            parms.AddWithValue("Password", DistrictParms.LoadDistrictParms().DefaultPasswordEncrypted);
            parms.AddWithValue("PasswordSalt", DistrictParms.LoadDistrictParms().DefaultPasswordEncryptedSalt);
            parms.AddWithValue("Email", email.Text);
            parms.Add(ThinkgateDataAccess.GetParmFromTable(userTypeIdTable.ToSql(), "Roles"));
            parms.Add(ThinkgateDataAccess.GetParmFromTable(schoolIdTable.ToSql(), "Schools"));
            parms.AddWithValue("PrimarySchool", DataIntegrity.ConvertToInt(cmbPrimarySchool.SelectedItem.Value));
            parms.AddWithValue("PrimaryUser", cmbPrimaryUser.SelectedItem.Text);
            parms.AddWithValue("TeacherID", string.Empty);
            parms.AddWithValue("Restrictions", restrictionsValue);   

            var drNewStaffUserPage = ThinkgateDataAccess.FetchDataRow(AppSettings.ConnectionString,
                                                                      Base.Classes.Data.StoredProcedures.ASPNET_TG_SECURITY_USER_CREATE_USER,
                                                                      System.Data.CommandType.StoredProcedure,
                                                                      parms,
                                                                      SessionObject.GlobalInputs);
            /*
             * Extract UserPage ID out of recordset and put in hidden field so that when we return to the client side, we
             * can offer user (through javascript) the opportunity to bring up Staff Object Page with new staff in it.
            */
            if (drNewStaffUserPage != null)
            {
                hdnNewStaffIDEncrypted.Value = Standpoint.Core.Classes.Encryption.EncryptString(drNewStaffUserPage["UserPage"].ToString());
                KenticoBusiness.AddUserAndRoles(loginID.Text);
            }

			//Dan - UserSync - Queue a UserSync Message here!
            //TODO: Michael Rue - complete user sync functionality
			//UserSyncHelperFactory.GetMsmqHelper().AddOrUpdateUser(loginID.Text, loginID.Text, null, email.Text, JsonConvert.SerializeObject(userSyncRoles));

            ScriptManager.RegisterStartupScript(this, typeof(AddStaff), "AddedStaff", "autoSizeWindow();", true);

            resultPanel.Visible = true;
            addPanel.Visible = false;
            lblResultMessage.Text = @"Staff successfully added!";
        }