public void AbleToCreateNewEmployeeWth_ValidData() { ExcelLib.PopulateInCollection(Test.Base.ExcelPath, "Employees"); NavigateToEmployeesPage(); Driver.wait(2); Name.SendKeys(ExcelLib.ReadData(10, "Name")); Username.SendKeys(ExcelLib.ReadData(10, "UserName")); Edit_Contact.Click(); Driver.driver.SwitchTo().Frame(Driver.driver.FindElement(By.TagName("iframe"))); SaveEditContactwithValidData(); Driver.wait(2); Driver.driver.SwitchTo().ParentFrame(); Password.SendKeys(ExcelLib.ReadData(10, "Password")); RetypePassword.SendKeys(ExcelLib.ReadData(10, "Confirm Password")); Driver.wait(2); if (!IsAdmin.Selected) { Thread.Sleep(3000); IsAdmin.Click(); } Save_btn.Click(); Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Save button clicked after entering valid data"); IWebElement title = Driver.driver.FindElement(By.XPath("html/body/div[4]/h2")); string page_title = title.Text; try { string URL = Driver.driver.Url; Console.WriteLine(URL); Assert.AreSame("http://52.65.131.15/User", URL); Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "User Navigated back to Administration>Employees Page"); } catch (Exception e) { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Still on Create New Employee Page, Should navigate back to Administration>Employees Page"); Back_to_list.Click(); } try { Search_For_Record("Valid"); } catch (Exception e) { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Employees details are not found in the list. Test Failed"); } }
//public string ScreenName { // get { // return string.Format( // "{0} <{1}>", // NickName, // UserName // ); // } //} protected override string[] GetSerializeFields() { return(new string[] { UserID.ToString(), UserName, Email, IsAdmin.ToString() }); }
public static bool GetIsAdmin(this IIdentity identity) { //string claimValue = ((ClaimsIdentity)identity).FindFirst("UserName").Value; Repository <IsAdmin> dbadmin = new Repository <IsAdmin>(); IsAdmin ia = dbadmin.GetByID(identity.Name); // Test for null to avoid issues during local testing return((ia != null) ? true : false); }
public Account ToAccount() { return(new Account(Name) { IsAdmin = IsAdmin.GetValueOrDefault(false), IsActive = IsActive.GetValueOrDefault(true), Password = Password }); }
public void Update() { Sql.Query.UpdateUser( UserId.ToSQLString(), IsAuthorized.ToSQLString(), IsAdmin.ToSQLString(), IsPartOfSeason.ToSQLString() ); }
public override int GetHashCode() { var result = 0; result = (result * 397) ^ (Name ?? String.Empty).GetHashCode(); result = (result * 397) ^ (Email ?? String.Empty).GetHashCode(); result = (result * 397) ^ IsAdmin.GetHashCode(); result = (result * 397) ^ (DisplayName ?? String.Empty).GetHashCode(); return(result); }
public override string ToString() { StringBuilder b = new StringBuilder(); b.AppendLine(Name); b.AppendLine(Password); b.AppendLine(CountryID.ToString()); b.AppendLine(IsAdmin.ToString()); b.AppendLine(ClientID.ToString()); return(b.ToString()); }
private dynamic GetCommonLocations() { dynamic ret = new ExpandoObject(); ret.editor = EditorLocations; if (IsAdmin.CurrentUserAdmin()) { ret.core = CoreLocations; ret.master = MasterLocations; } return(ret); }
public object GetActionSpecificParameters() { switch (Action) { case UserAdminAction.EnableUser: case UserAdminAction.DisableUser: return(new { CDSId }); case UserAdminAction.AddProgramme: return(new { CDSId, ProgrammeId, CanEditProgramme }); case UserAdminAction.RemoveProgramme: return(new { CDSId, ProgrammeId }); case UserAdminAction.ManageProgrammes: return(new { CDSId, ProgrammeId }); case UserAdminAction.AddUser: return(new { CDSId, FullName, IsAdmin = IsAdmin.GetValueOrDefault(), Mail }); case UserAdminAction.SetAsAdministrator: case UserAdminAction.UnsetAsAdministrator: return(new { CDSId }); } return(new { CDSId, FullName, ProgrammeId, IsAdmin = IsAdmin.GetValueOrDefault() }); }
public override int GetHashCode() { unchecked { var hashCode = Id; hashCode = (hashCode * 397) ^ (Username != null ? Username.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Firstname != null ? Firstname.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Lastname != null ? Lastname.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Password != null ? Password.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsAdmin.GetHashCode(); return(hashCode); } }
private dynamic GetCommonLocations() { EditingContextRegistration ec = _registration.GetScsRegistration <EditingContextRegistration>(); dynamic ret = new ExpandoObject(); ret.editor = ec.EditorLocations; if (IsAdmin.CurrentUserAdmin()) { ret.core = ec.CoreLocations; ret.master = ec.MasterLocations; } return(ret); }
/// <summary> /// Creates an XML element containing the data for the invite /// </summary> /// <param name="document">XML document the element will be added to</param> /// <returns>XML element containing the data for the invite</returns> public XmlElement ToXml(XmlDocument document) { XmlElement invite = document.CreateElement("INVITE"); XmlAttribute id = document.CreateAttribute("Id"); id.Value = Id.ToString(); invite.Attributes.Append(id); XmlAttribute emailAddress = document.CreateAttribute("EmailAddress"); emailAddress.Value = EmailAddress; invite.Attributes.Append(emailAddress); XmlAttribute isAdmin = document.CreateAttribute("IsAdmin"); isAdmin.Value = IsAdmin.ToString(); invite.Attributes.Append(isAdmin); XmlAttribute includesCeremony = document.CreateAttribute("IncludesCeremony"); includesCeremony.Value = IncludesCeremony.ToString(); invite.Attributes.Append(includesCeremony); XmlAttribute reserveSandholeRoom = document.CreateAttribute("ReserveSandholeRoom"); reserveSandholeRoom.Value = ReserveSandholeRoom.ToString(); invite.Attributes.Append(reserveSandholeRoom); XmlAttribute emailMessages = document.CreateAttribute("EmailMessages"); emailMessages.Value = EmailMessages.ToString(); invite.Attributes.Append(emailMessages); XmlAttribute notifyGiftWebsite = document.CreateAttribute("NotifyGiftWebsite"); notifyGiftWebsite.Value = NotifyGiftWebsite.ToString(); invite.Attributes.Append(notifyGiftWebsite); XmlElement guests = document.CreateElement("GUESTS"); invite.AppendChild(guests); foreach (Guest guest in Guests) { guests.AppendChild(guest.ToXml(document)); } return(invite); }
protected void Page_Load(object sender, EventArgs e) { this.CheckUserSession(); this.CheckQueryString(); if (!Page.IsPostBack) { this.SelectRecordDiscount(); if (IsAdmin.ToString() == "True") { CompanyInformationEditingPage = "AdminCompanyEdit.aspx"; this.Session["AdminEditCompanyProfileID"] = ProfileID.ToString(); } else { CompanyInformationEditingPage = "UserProfile_Edit.aspx"; } } }
public bool ApplicableSidekick() { bool admin = IsAdmin.CurrentUserAdmin(); if (admin) { return(true); } if (AdminOnly) { return(false); } if (Roles.Count == 0) { return(true); } return(IsAdmin.CurrentUserInRoleList(Roles)); }
private void CheckUserSession() { if (this.Session["CORP_PROFILE_CODE"] != null && this.Session["CORP_COUNTRY_CODE"] != null) { intCountryID = Convert.ToInt32(this.Session["CORP_COUNTRY_CODE"].ToString()); IsAdmin = Convert.ToBoolean(this.Session["ISADMIN"]); if (IsAdmin.ToString() == "True") { ProfileID = Convert.ToInt32(this.Session["AdminCompanyProfileID"].ToString()); } else { ProfileID = Convert.ToInt32(this.Session["CORP_PROFILE_CODE"].ToString()); } } else { Response.Redirect("Default.aspx"); } }
public void CreateEmployee_Wth_InvalidData() { ExcelLib.PopulateInCollection(Test.Base.ExcelPath, "Employees"); NavigateToEmployeesPage(); Driver.wait(2); Name.SendKeys(ExcelLib.ReadData(2, "Name")); Username.SendKeys(ExcelLib.ReadData(2, "UserName")); Password.SendKeys(ExcelLib.ReadData(2, "Password")); RetypePassword.SendKeys(ExcelLib.ReadData(2, "Confirm Password")); Driver.wait(2); if (!IsAdmin.Selected) { Thread.Sleep(3000); IsAdmin.Click(); } Save_btn.Click(); // To check is user is still on the same page. try { IWebElement title = Driver.driver.FindElement(By.XPath("html/body/div[4]/h2")); string page_title = title.Text; Console.WriteLine(page_title); Assert.AreEqual("Employee Details", page_title); Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Still on Create new Employee Page, Details not added"); } catch (Exception e) { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Navigated to a different page"); } // To check if user is getting any error message on entering Invalid data try { IWebElement element = Driver.driver.FindElement(By.XPath("html/body/div[4]/form/div/div[1]/div/span/span")); bool visible = element.Displayed; string actual_err = element.Text; string expected_err = ExcelLib.ReadData(2, "Error_messages"); try { if (visible == true) { Assert.AreEqual(expected_err, actual_err); Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Name Field: Correct error message displayed"); } } catch (Exception e) { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Name Field: Incorrect error message displayed"); } } catch (Exception e) { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Name Field: Error message missing"); } // Validate error message for UserName Textfield try { IWebElement element = Driver.driver.FindElement(By.XPath("html/body/div[4]/form/div/div[2]/div/span/span")); bool visible = element.Displayed; string actual_err = element.Text; string expected_err = ExcelLib.ReadData(3, "Error_messages"); try { if (visible == true) { Assert.AreEqual(expected_err, actual_err); Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "UserName Field: Correct error message displayed"); } } catch (Exception e) { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "UserName Field: Incorrect error message displayed"); } } catch (Exception e) { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "UserName Field: Error message missing"); } // Validate error message for Password Textfield try { IWebElement element = Driver.driver.FindElement(By.XPath("html/body/div[4]/form/div/div[4]/div/span/span")); bool visible = element.Displayed; string actual_err = element.Text; string expected_err = ExcelLib.ReadData(4, "Error_messages"); try { if (visible == true) { Assert.AreEqual(expected_err, actual_err); Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Password Field: Correct error message displayed"); } } catch (Exception e) { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Password Field: Incorrect error message displayed"); } } catch (Exception e) { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Password Field: Error message missing"); } // Calling Search method to verify if invalid record is created try { Search_For_Record("Invalid"); } catch { Test.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Invalid data Record Not Created"); } }
public override string ToString() { return(string.Join("|", new string[] { Name, Avatar, Icon, Badges, IsAdmin.ToString(), Clan, Faction, Country })); }
public bool IsCurrentUserInRole(IEnumerable <string> roles) => IsAdmin.CurrentUserInRoleList(new List <string>(roles));
// format for file public string FormatForFile() { return($"{IDUser}{DELIMITER}{FirstName}{DELIMITER}{LastName}{DELIMITER}{Password}{DELIMITER}{IsAdmin.ToString()}{DELIMITER}{Telephone}{DELIMITER}{City.ToString()}{DELIMITER}"); }