public ActionResult Create([Bind(Include = "TicketId")] TicketAttachment ticketAttachment, Ticket ticket, string attachmentTitle, string attachmentDescription, HttpPostedFileBase attachment) { if (ModelState.IsValid) { var newTicket = db.Tickets.Find(ticketAttachment.TicketId); ticketAttachment.Title = attachmentTitle; ticketAttachment.Description = attachmentDescription; ticketAttachment.Created = DateTime.Now; ticketAttachment.UserId = User.Identity.GetUserId(); //Validator if (ImageHelper.IsValidAttachment(attachment)) { var fileName = Path.GetFileName(attachment.FileName); attachment.SaveAs(Path.Combine(Server.MapPath("~/Attachments/"), fileName)); ticketAttachment.AttachmentUrl = "/Attachments/" + fileName; } db.TicketAttachments.Add(ticketAttachment); db.SaveChanges(); if (ticketAttachment.UserId != ticket.AssignedToUserId) { TicketHelper.CreateAttachmentNotification(newTicket); } return(RedirectToAction("Details", "Tickets", new { id = ticketAttachment.TicketId })); } ViewBag.UserId = new SelectList(db.Users, "Id", "FirstName", ticketAttachment.UserId); return(View(ticketAttachment)); }
public ActionResult Edit([Bind(Include = "Id,Title,Description,Created,Updated,ProjectId,TicketTypeId,TicketPriorityId,TicketStatusId,OwnerUserId,AssignedToUserId")] Ticket ticket) { if (ModelState.IsValid) { //db.Entry(ticket).State = EntityState.Modified; //db.SaveChanges(); TicketHelper.Edit(ticket.Id, ticket.OwnerUserId, ticket.Title, ticket.Description, ticket.TicketTypeId, ticket.TicketPriorityId, ticket.TicketStatusId, ticket.AssignedToUserId); var modifiedTicket = db.Tickets.Find(ticket.Id); TicketNotificationHelper.AddNotification(modifiedTicket.Id, modifiedTicket.AssignedToUserId, NotificationType.ModifiedBy, User.Identity.GetUserName()); db.SaveChanges(); return(RedirectToAction("Index", new { userId = User.Identity.GetUserId() })); //return RedirectToAction("Index", "Projects", new { userId = User.Identity.GetUserId() }); } string roleId = db.Roles.FirstOrDefault(r => r.Name == "Developer").Id; var developers = db.Users.Where(u => u.Roles.Any(r => r.RoleId == roleId)); ViewBag.AssignedToUserId = new SelectList(developers, "Id", "Email", ticket.AssignedToUserId); //ViewBag.ProjectId = new SelectList(db.Projects, "Id", "Name", ticket.ProjectId); ViewBag.TicketPriorityId = new SelectList(db.TicketPriorities, "Id", "Name", ticket.TicketPriorityId); ViewBag.TicketStatusId = new SelectList(db.TicketStatuses, "Id", "Name", ticket.TicketStatusId); ViewBag.TicketTypeId = new SelectList(db.TicketTypes, "Id", "Name", ticket.TicketTypeId); return(View(ticket)); }
public ActionResult DeleteAttchmentFormTcket(int id) { var ticketId = db.Attachments.Find(id).TicketId; TicketHelper.DeleteAttchmentFormTcket(id); return(RedirectToAction("Detail", new { id = ticketId })); }
private void ValidateData(bool all = false, bool langId = false, bool deviceId = false, bool clientId = false, bool confidence = false) { if (all || langId) { if (!string.IsNullOrEmpty(_langId) && _langId.Length != 2) { throw new ArgumentException("LanguageId not valid."); } } if (all || deviceId) { if (!string.IsNullOrEmpty(_deviceId) && !TicketHelper.ValidateUserId(_deviceId)) { throw new ArgumentException("Stake not valid."); } } if (all || clientId) { if (!string.IsNullOrEmpty(_clientId) && !TicketHelper.ValidateUserId(_clientId)) { throw new ArgumentException("ClientId not valid."); } } if (all || confidence) { if (_confidence < 0) { throw new ArgumentException("Confidence not valid."); } } }
public ActionResult DetailsTicket(int?ticketId) { var ticket = DbContext.Tickets.FirstOrDefault(tckt => tckt.Id == ticketId); if (ticket is null) { return(RedirectToDashError()); } TicketViewModel viewModelTicket = null; if (TicketHelper.UserCanViewDetails(User, ticket)) { viewModelTicket = TicketHelper.MapTicket(ticket, User); } else { return(RedirectToDashError()); } if (viewModelTicket is null) { return(RedirectToDashError()); } return(View(viewModelTicket)); }
public ActionResult EditComment(int?commentId) { // Get comment being edited var comment = DbContext.Comments.FirstOrDefault(cmt => cmt.Id == commentId); if (comment is null) { return(RedirectToDashError()); } // Do user validation if (TicketHelper.UserCanAccessComment(User, comment)) { var commentViewModel = new EditCommentTicketViewModel() { Id = comment.Id, TicketId = comment.TicketId, Comment = comment.CommentData, }; return(View(commentViewModel)); } else { return(RedirectToDashError()); } }
public ActionResult Delete(int ID) { // check the ticket ID supplied if (ID != 0) { TicketHelper ticketHelper = new TicketHelper(c_repository); // retrieve the Ticket matching the id supplied Ticket ticketToDelete = ticketHelper.RetrieveTicket(ID); // was the ticket found? if (ticketToDelete != null) { // map the Ticket object to the appropriate view model for return // return the view with the Ticket to delete as the model return(View(Mapper.Map <TicketDetailViewModel>(ticketToDelete))); } else { // no matching ticket found, return http not found error return(HttpNotFound()); } } else { // no ticket ID supplied, return bad request error return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "No ticket ID was supplied.")); } }
public ActionResult EditComment(EditCommentTicketViewModel formData) { if (!ModelState.IsValid) { return(View(formData)); } if (formData is null) { return(RedirectToDashError()); } var comment = DbContext.Comments.FirstOrDefault(cmt => cmt.Id == formData.Id); if (comment is null) { return(RedirectToDashError()); } if (TicketHelper.UserCanAccessComment(User, comment)) { comment.CommentData = formData.Comment; DbContext.SaveChanges(); return(RedirectToAction("DetailsTicket", "Ticket", new { ticketId = formData.TicketId })); } else { return(RedirectToDashError()); } }
public ActionResult EditTicket(int?ticketId) { var ticket = DbContext.Tickets.FirstOrDefault(tckt => tckt.Id == ticketId); if (ticket is null) { return(RedirectToDashError()); } EditTicketViewModel viewModelTicket; if (TicketHelper.UserCanAccessTicket(User, ticket)) { viewModelTicket = TicketHelper.TicketDataByRole(ticket, User, RoleManager, UserManager, DbContext); } else { return(RedirectToDashError()); } if (viewModelTicket is null) { return(RedirectToDashError()); } return(View(viewModelTicket)); }
public ActionResult FileUploadTicket(int?ticketId) { if (ticketId is null) { return(RedirectToDashError()); } var ticket = DbContext.Tickets.FirstOrDefault(tckt => tckt.Id == ticketId); if (ticket is null) { return(RedirectToDashError()); } if (TicketHelper.UserCanAccessTicket(User, ticket)) { var file = new UploadFileTicketViewModel() { TicketId = (int)ticketId }; return(View(file)); } else { return(RedirectToDashError()); } }
// GET: Tickets/Details/5 //public ActionResult Details(int? id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // var ticket = db.Tickets.Find(id); // if (ticket == null) // { // return HttpNotFound(); // } // TicketDetailsViewModel TicketDetailsVM = new TicketDetailsViewModel(); // TicketDetailsVM.Histories = db.TicketHistories.Where(tH => tH.TicketId == id).ToList(); // return View(ticket); //} // GET: Tickets/Details/5 public ActionResult Details(int?id) { UserRolesHelper userRolesHelper = new UserRolesHelper(); //UserRolesViewModel userRoles = userRolesViewModel(); var userId = User.Identity.GetUserId(); TicketHelper ticketHelper = new TicketHelper(); Ticket ticket = db.Tickets.Find(id); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (ticket == null) { return(HttpNotFound()); } var userTickets = ticketHelper.GetUserTickets(userId); if (userTickets.Any(t => t.Id == ticket.Id) || User.IsInRole("Admin") || ticket.Project.ProjectManagerId == User.Identity.GetUserId()) { TicketDetailsViewModel TicketDetailsVM = new TicketDetailsViewModel(); TicketDetailsVM.Histories = db.TicketHistories.Where(tH => tH.TicketId == id).ToList(); return(View(ticket)); } return(RedirectToAction("Index", "Home")); }
/// <summary> /// Add the bet cancel /// </summary> /// <param name="betId">The bet id</param> /// <param name="percent">The cancel percent value of the assigned bet (quantity multiplied by 10_000 and rounded to a int value)</param> /// <returns>Returns a <see cref="ITicketCancelBuilder"/></returns> public ITicketCancelBuilder AddBetCancel(string betId, int?percent) { if (!TicketHelper.ValidateTicketId(betId)) { throw new ArgumentException("BetId not valid"); } if (!TicketHelper.ValidatePercent(percent)) { throw new ArgumentException("Percent not valid"); } if (_betCancels == null) { _betCancels = new List <IBetCancel>(); } if (_betCancels.Count >= 50) { throw new ArgumentException("List size limit reached. Only 50 allowed."); } if (_betCancels.Any(a => a.BetId.Equals(betId, StringComparison.InvariantCultureIgnoreCase))) { throw new ArgumentException("BetId already in list."); } _betCancels.Add(new BetCancel(betId, percent)); return(this); }
private void ValidateData(bool all = false, bool betId = false, bool stake = false, bool selectedSystems = false, bool selections = false, bool reofferRefId = false, bool sumOfWins = false) { if (all || betId) { if (!string.IsNullOrEmpty(_betId) && !TicketHelper.ValidateTicketId(_betId)) { throw new ArgumentException("BetId not valid."); } } if (all || stake) { if (_stake == null) { throw new ArgumentException("Stake not valid."); } } if (all || selectedSystems) { if (!(_selectedSystems == null || (_selectedSystems.Any() //&& _selectedSystems.Count() < 64 && _selectedSystems.Count() == _selectedSystems.Distinct().Count() && _selectedSystems.All(a => a > 0)))) { throw new ArgumentException("SelectedSystems not valid."); } } if (all || selections) { if (!(_selections != null && _selections.Any() //&& _selections.Count < 64 && _selections.Count == _selections.Distinct().Count())) { throw new ArgumentException("Selections not valid."); } } if (all || reofferRefId) { if (!(string.IsNullOrEmpty(_reofferRefId) || _reofferRefId.Length <= 50)) { throw new ArgumentException("ReofferRefId not valid."); } } if (all || sumOfWins) { if (_sum < 0) { throw new ArgumentException("SumOfWins not valid."); } } if (all) { if (_selectedSystems != null && (_selectedSystems.Count() > _selections.Count || _selectedSystems.Any(a => a > _selections.Count))) { throw new ArgumentException("SelectionSystem are not valid."); } } }
/// <summary> /// Initializes a new instance of the <see cref="TicketCashout"/> class /// </summary> /// <param name="ticketId">The ticket identifier</param> /// <param name="bookmakerId">The bookmaker identifier</param> /// <param name="stake">The cashout stake</param> /// <param name="percent">The cashout percent</param> /// <param name="betCashouts">The list of <see cref="IBetCashout"/></param> public TicketCashout(string ticketId, int bookmakerId, long?stake, int?percent, IReadOnlyCollection <IBetCashout> betCashouts) { Guard.Argument(ticketId).Require(TicketHelper.ValidateTicketId(ticketId)); Guard.Argument(bookmakerId, nameof(bookmakerId)).Positive(); Guard.Argument(stake, nameof(stake)).Require(stake >= 0 || percent >= 0 || (betCashouts != null && betCashouts.Any())); if (percent != null && stake == null) { throw new ArgumentException("If percent is set, also stake must be."); } if (betCashouts != null && (stake != null || percent != null)) { throw new ArgumentException("Stake and/or Percent cannot be set at the same time as BetCashouts."); } TicketId = ticketId; BookmakerId = bookmakerId; CashoutStake = stake; CashoutPercent = percent; BetCashouts = betCashouts; Timestamp = DateTime.UtcNow; Version = TicketHelper.MtsTicketVersion; CorrelationId = TicketHelper.GenerateTicketCorrelationId(); }
private void linkRefresh_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { txtKey.Text = ""; myList.Clear(); TicketHelper.GetPassengers(); LoadPassenger(StaticValues.PassengerList); }
async private void ToolbarItem_Clicked(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(entryMonto.Text) || string.IsNullOrWhiteSpace(ImagePathTemp)) { await DisplayAlert("Error", "El monto y la foto de la multa son obligatorios", "Ok"); return; } var ticket = (BindingContext as Ticket); ticket.FechaMulta = PickerFechaMulta.Date; ticket.Monto = Convert.ToDouble(entryMonto.Text); ticket.Pagada = switchPagada.IsToggled; ticket.FechaPago = PickerFechaPago.Date; ticket.Archivo = ImagePathTemp; ticket.Observaciones = entryObservaciones.Text; try { int saved = await TicketHelper.SaveItemAsync(ticket); await DisplayAlert("Actualizar", "Multa actualizada correctamente", "Ok"); await Navigation.PopAsync(); } catch (Exception) { await DisplayAlert("Guardar", "La Multa NO se pudo actualizar", "Ok"); return; } }
// GET: Tickets/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Ticket ticket = db.Tickets.Find(id); if (ticket == null) { return(HttpNotFound()); } if (TicketHelper.TicketIsEditableByUser(ticket)) { ViewBag.AssignedToUserId = new SelectList(db.Users, "Id", "FullName", ticket.AssignedToUserId); ViewBag.TicketTypeId = new SelectList(db.TicketTypes, "Id", "Name", ticket.OwnerUserId); ViewBag.ProjectId = new SelectList(db.Projects, "Id", "Name", ticket.ProjectId); ViewBag.TicketPriorityId = new SelectList(db.TicketPriorities, "Id", "Name", ticket.TicketPriorityId); ViewBag.TicketStatusId = new SelectList(db.TicketStatus, "Id", "Name", ticket.TicketStatusId); return(View(ticket)); } else { return(RedirectToAction("AccessViolation", "Admin")); }; }
/// <summary> /// Add the bet cashout /// </summary> /// <param name="betId">The bet id</param> /// <param name="stake">The cashout stake value of the assigned bet (quantity multiplied by 10_000 and rounded to a long value)</param> /// <param name="percent">The cashout percent value of the assigned bet (quantity multiplied by 10_000 and rounded to a int value)</param> /// <returns>Returns a <see cref="ITicketCashoutBuilder"/></returns> public ITicketCashoutBuilder AddBetCashout(string betId, long stake, int?percent) { if (!TicketHelper.ValidateTicketId(betId)) { throw new ArgumentException("BetId not valid"); } if (stake < 1) { throw new ArgumentException("Stake not valid"); } if (!TicketHelper.ValidatePercent(percent)) { throw new ArgumentException("Percent not valid"); } if (_betCashouts == null) { _betCashouts = new List <IBetCashout>(); } if (_betCashouts.Any(a => a.BetId.Equals(betId, StringComparison.InvariantCultureIgnoreCase))) { throw new ArgumentException("BetId already in list."); } _betCashouts.Add(new BetCashout(betId, stake, percent)); return(this); }
async private void ToolbarItem_Clicked(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(entryMonto.Text) || string.IsNullOrWhiteSpace(ImagePath)) { await DisplayAlert("Error", "El monto y la foto de la multa son obligatorios", "Ok"); return; } Ticket ticket = new Ticket { FechaMulta = PickerFechaMulta.Date, Monto = Convert.ToDouble(entryMonto.Text), Pagada = switchPagada.IsToggled, FechaPago = PickerFechaPago.Date, Archivo = ImagePath, Observaciones = entryObservaciones.Text, CarId = (BindingContext as Car).Id }; try { int saved = await TicketHelper.SaveItemAsync(ticket); await DisplayAlert("Guardar", "Multa registrada correctamente", "Ok"); await Navigation.PopAsync(); } catch (Exception) { await DisplayAlert("Guardar", "La Multa NO se pudo registrar", "Ok"); return; } }
public ActionResult Index(string userId, string role) { ViewBag.SelectSort = new SelectList(sortModel.Options); ViewBag.SelectFilter = new SelectList(filterModel.Options); var tickets = TicketHelper.GetTickets(userId, role).ToList(); return(View(tickets)); }
/// <summary> /// Gets the sent ticket /// </summary> /// <param name="ticketId">The ticket identifier</param> /// <returns>ISdkTicket</returns> public ISdkTicket GetSentTicket(string ticketId) { if (_ticketCache.TryRemove(ticketId, out var ci)) { return(TicketHelper.GetTicketInSpecificType(ci)); } return(null); }
public void TestMethod1() { var tickets = TicketHelper.GenerateTickets(); var sorted = TicketSortManager.Sort(tickets); bool result = TicketHelper.IsOrdered(sorted.ToArray()); Assert.AreEqual(result, true); }
/// <summary> /// Sets the alternative stake reference ticket id /// </summary> /// <param name="altStakeRefId">The alt stake reference id</param> /// <returns>Returns a <see cref="ITicketBuilder" /></returns> public ITicketBuilder SetAltStakeRefId(string altStakeRefId) { if (!TicketHelper.ValidateTicketId(altStakeRefId)) { throw new ArgumentException("AltStakeRefId not valid"); } _altStakeRefId = altStakeRefId; return(this); }
async protected override void OnAppearing() { base.OnAppearing(); var car = BindingContext as Car; var tickets = await TicketHelper.GetTickets(car); TicketsListView.ItemsSource = tickets; }
/// <summary> /// Sets the cashout percent /// </summary> /// <param name="percent">The cashout percent</param> /// <returns>Returns a <see cref="ITicketCashoutBuilder"/></returns> public ITicketCashoutBuilder SetCashoutPercent(int percent) { if (!TicketHelper.ValidatePercent(percent)) { throw new ArgumentException("Percent not valid."); } _percent = percent; return(this); }
/// <summary> /// Sets the ticket id to Cashout /// </summary> /// <param name="ticketId">The ticket id</param> /// <returns>Returns a <see cref="ITicketCashoutBuilder" /></returns> /// <value>Unique ticket id (in the client's system)</value> public ITicketCashoutBuilder SetTicketId(string ticketId) { if (!TicketHelper.ValidateTicketId(ticketId)) { throw new ArgumentException("TicketId not valid"); } _ticketId = ticketId; return(this); }
public ActionResult FileUploadTicket(UploadFileTicketViewModel formData) { if (formData is null) { return(RedirectToDashError()); } var ticket = DbContext.Tickets.FirstOrDefault(tckt => tckt.Id == formData.TicketId); if (ticket is null) { return(RedirectToDashError()); } if (TicketHelper.UserCanAccessTicket(User, ticket) && formData.Media != null) { var uploadFolder = Server.MapPath("~/Upload/"); var user = UserManager.FindById(User.Identity.GetUserId()); // If the Upload directory doesn't exist, create it. if (!Directory.Exists(uploadFolder)) { Directory.CreateDirectory(uploadFolder); } // New file name, random gen. var fileNameGen = Guid.NewGuid(); // The GUID ensure no file will have the same name. var fullFilePathWName = uploadFolder + fileNameGen + Path.GetExtension(formData.Media.FileName); // Save file to Upload folder formData.Media.SaveAs(fullFilePathWName); // Set media URL to later access the file. Then save to DB. // Have an object storing the name of the file, short URL to the file, and the path of the file. ticket.Files.Add(new TicketFile() { MediaUrl = "~/Upload/" + fileNameGen + Path.GetExtension(formData.Media.FileName), FileName = fileNameGen.ToString() + Path.GetExtension(formData.Media.FileName), Title = formData.Media.FileName, TicketId = ticket.Id, UserId = user.Id }); // Notify users of added file TicketHelper.SendNotificationsToUsers(ticket, "File added"); DbContext.SaveChanges(); return(RedirectToAction("DetailsTicket", "Ticket", new { ticketId = ticket.Id })); } else { return(RedirectToDashError()); } }
/// <summary> /// Sets the reoffer id /// </summary> /// <param name="reofferId">The reoffer id</param> /// <returns>Returns a <see cref="ITicketBuilder" /></returns> public ITicketBuilder SetReofferId(string reofferId) { if (!TicketHelper.ValidateTicketId(reofferId)) { throw new ArgumentException("ReofferId not valid"); } _reofferId = reofferId; return(this); }
public ActionResult AssignUserToTicket(int id, string SubmitterId) { if (ModelState.IsValid) { TicketHelper.AssignUserToTicket(db, id, SubmitterId); return(RedirectToAction("Detail", new { id })); } ViewBag.SubmitterId = new SelectList(UserHelper.AllUsersInRole("Developer"), "Id", "Email"); return(View()); }
/// <summary> /// Constructor /// </summary> /// <param name="userManager"></param> /// <param name="signInManager"></param> /// <param name="ticketHelper"></param> public AuthController( UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, TicketHelper ticketHelper ) { _userManager = userManager; _signInManager = signInManager; _ticketHelper = ticketHelper; }
public void buyTicket() { string[] username = null; string[] password = null; string[] newusername = null; XMLParse oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSetting.xml"); loginHelper = new AttendeeLoginHelper(GetWebDriver()); eventHelper = new EventHelper(GetWebDriver()); ticketHelper = new TicketHelper(GetWebDriver()); username = oXMLData.getData("settings/credentials", "AttendeeUsername"); password = oXMLData.getData("settings/credentials", "AttendeePassword"); newusername = oXMLData.getData("settings/credentials", "Username"); //Wait for text loginHelper.WaitForTextInPage("Use your email to sign in.", 40); //Verify Page title verifyTitle("Attendee.Events - Log in"); //Login with email address Login(username[0], password[0]); Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]); //Click on sigin button loginHelper.ClickElement("Signin"); //Verify Page title verifyTitle("Event List"); // String Eventname = ticketHelper.GetText("FirstEvent"); //Open first event ticketHelper.ClickElement("FirstEvent"); //wait for text ticketHelper.WaitForTextInPage("Total:",30); //Click on register tab ticketHelper.clickLastElement("RegisterTab"); //Click on Ticketting ticketHelper.ClickElement("Ticketting"); //Wait for text ticketHelper.WaitForTextInPage("New Free Ticket", 30); //Click on New Free ticket ticketHelper.verifyticket("FreeTicket"); //Click on home tab ticketHelper.ClickElement("HomeTab"); //Click on user-id ticketHelper.ClickElement("LogOff"); //Wait for text ticketHelper.WaitForTextInPage("Log in", 30); //Go to registration page ticketHelper.ClickElement("Register"); //Click on Login link ticketHelper.ClickElement("Login"); //Login into the application Login(newusername[0],password[0]); //Click on sign in button loginHelper.ClickElement("Signin"); //wait for text ticketHelper.WaitForTextInPage(newusername[0],30); //Go to registration page ticketHelper.ClickElement("Register"); //Enter Quantity of ticket ticketHelper.type("QuanTicket", "2"); //Click on Buy now button ticketHelper.performClick("GetRegister"); //Wait for text ticketHelper.WaitForTextInPage("Submit Registration", 20); //Click on Submit registration ticketHelper.performClick("SubmitRegistration"); //wait for text ticketHelper.WaitForTextInPage("Ticket", 60); //verify status ticketHelper.WaitForTextInPage("Status:", 20); // ticketHelper.WaitForTextInPage("approved", 30); //Capture screenshot fot the screen loginHelper.TakeScreenshot("BuyTicket - Attendee"); }
public void downloadAttendee() { string username = ""; string[] password = null; XMLParse oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSetting.xml"); loginHelper = new AttendeeLoginHelper(GetWebDriver()); eventHelper = new EventHelper(GetWebDriver()); ticketHelper = new TicketHelper(GetWebDriver()); username = loginHelper.GetFromFile("Register"); password = oXMLData.getData("settings/credentials", "AttendeePassword"); String EventName = "Test_Event" + AlwaysRandom(); String EventURL = URL + "/" + EventName + "/E/"; int Startdate = GetTodayDate()+1; int Enddate = GetTodayDate() + 2; //Wait for text loginHelper.WaitForTextInPage("Use your email to sign in.", 40); //Verify Page title verifyTitle("Attendee.Events - Log in"); //Login with email address Login(username, password[0]); Console.WriteLine("Logged in as: " + username + " / " + password[0]); //Click on sigin button loginHelper.ClickElement("Signin"); //Verify Page title verifyTitle("Event List"); //CLick on Event dropdown. eventHelper.ClickElement("EventDropdown"); //Click on Create new event eventHelper.ClickElement("CreateNewEvent"); //wait for text eventHelper.WaitForTextInPage("Event Type", 20); //Verify title verifyTitle("Create"); //Select Event type eventHelper.SelectValueFilter("EventType", "Conference"); //Enter Event title eventHelper.type("EventTitle", EventName); //Click on Manual Location eventHelper.ClickElement("ManualLocation"); //Enter Venue eventHelper.type("VenueName", "Noida"); //Enter Address 1 eventHelper.type("Address1", "Sector"); //Enter Adresss 2 eventHelper.type("Address2", "70"); //Enter City eventHelper.type("City", "Noida"); //Enter State eventHelper.type("State", "UP"); //Enter Zip eventHelper.type("Zip", "201301"); //Enter Start Date eventHelper.SelectDate("StartDate", Startdate.ToString()); //Enter End Date eventHelper.SelectDate("EndDate", Enddate.ToString()); //Write Description eventHelper.typeDescription(0, "This is test description"); //Click on 'Create Event button. eventHelper.ClickElement("Create"); //wait for text eventHelper.WaitForTextInPage("No sales", 30); //Verify title verifyTitle(EventName + " - Dashboard"); //click on event info eventHelper.ClickElement("eventregistration"); //scroll eventHelper.scrollToElement("downloadattendee"); //click on ticket eventHelper.ClickElement("downloadattendee"); //Click on user-id loginHelper.ClickElement("ClickId"); //Logout from the application. loginHelper.ClickElement("LogOut"); //Capture screenshot fot the screen loginHelper.TakeScreenshot("CreateEvent - Attendee"); }
public void approveAbstract() { string username = ""; string[] password = null; string[] newusername = null; XMLParse oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSetting.xml"); loginHelper = new AttendeeLoginHelper(GetWebDriver()); eventHelper = new EventHelper(GetWebDriver()); ticketHelper = new TicketHelper(GetWebDriver()); abstractHelper = new AbstractHelper(GetWebDriver()); username = loginHelper.GetFromFile("Register"); password = oXMLData.getData("settings/credentials", "AttendeePassword"); newusername = oXMLData.getData("settings/credentials", "Username"); //Wait for text loginHelper.WaitForTextInPage("Use your email to sign in.", 40); //Verify Page title verifyTitle("Attendee.Events - Log in"); //Login with email address Login(username, password[0]); Console.WriteLine("Logged in as: " + username + " / " + password[0]); //Click on sigin button loginHelper.ClickElement("Signin"); //Verify Page title verifyTitle("Event List"); // String Eventname = ticketHelper.GetText("FirstEvent"); //Open first event ticketHelper.ClickElement("FirstEvent"); //wait for text ticketHelper.WaitForTextInPage("Total:",30); //Click on home tab ticketHelper.ClickElement("HomeTab"); //Click on user-id ticketHelper.ClickElement("LogOff"); //Wait for text ticketHelper.WaitForTextInPage("Log in", 30); //Go to speaker page abstractHelper.ClickElement("Speaker"); //Click on Login link ticketHelper.ClickElement("Login"); //Login into the application Login(newusername[0],password[0]); //Click on sign in button loginHelper.ClickElement("Signin"); //wait for text ticketHelper.WaitForTextInPage(newusername[0],30); //Go to registration page abstractHelper.ClickElement("Speaker"); //Wait for text abstractHelper.WaitForTextInPage("Speaker", 30); //Click on Submit abstract button. abstractHelper.ClickElement("SubmitAbstract"); //wait for text abstractHelper.WaitForTextInPage("New", 30); //Click on New Button abstractHelper.ClickElement("NewAbstract"); //wait for text abstractHelper.WaitForTextInPage("Create New Abstract", 30); String abstractTitle = "Abstract"+AlwaysRandom(); //Enter title abstractHelper.type("Title", abstractTitle); //Enter abstract abstractHelper.typeDescription(0, "Demo Test"); //Enter Objectvie abstractHelper.typeDescription(1, "Demo Test"); //Enter abstractHelper.typeDescription(2,"Demo test"); //Submit abstract abstractHelper.performClick("Submit"); //wait for txt abstractHelper.WaitForTextInPage(abstractTitle,40); Logout(); //Verify Page title verifyTitle("Attendee.Events - Log in"); //Login with email address Login(username, password[0]); //Click on sigin button loginHelper.ClickElement("Signin"); //Open first event ticketHelper.ClickElement("FirstEvent"); //wait for text ticketHelper.WaitForTextInPage("Total:", 30); //Click on Speaker abstractHelper.ClickElement("SpeakerCreater"); //Click on submition abstractHelper.ClickElement("Submission"); //wait for text abstractHelper.WaitForTextInPage("Abstracts", 30); //verify abstract available abstractHelper.WaitForTextInPage(abstractTitle,30); //get count of approved abstract int approvedcount = abstractHelper.getCount("AccepttedRow"); //click on approve button abstractHelper.ClickElement("Accept"); //verify approved abstract displayed under teh approved section abstractHelper.verifyresult("AccepttedRow", approvedcount, "Greater"); //Capture screenshot fot the screen loginHelper.TakeScreenshot("ApproveAbstract - Attendee"); }