protected void Page_Load(object sender, EventArgs e) { string qID = Request.QueryString["id"]; this.invalidQueue.Visible = false; if (!string.IsNullOrEmpty(qID)) { Guid qGUI = Guid.Parse(qID); HelperClass_Queue hcq = new HelperClass_Queue(); Queue q = hcq.GetQueue(qGUI); if (Membership.GetUser() != null && q.Queue_UserID == (Guid)Membership.GetUser().ProviderUserKey) { List<Participant> lp = hcq.GetParticipants(qGUI); this.GridView_Participants.DataSource = lp; this.GridView_Participants.DataBind(); return; } } this.invalidQueue.Visible = true; //this.adminDiv.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Session["queueEdit"] = null; string queueId = Request.QueryString["queueId"]; if (queueId != null) { HelperClass_Queue hcq = new HelperClass_Queue(); Queue q = hcq.GetQueue(Guid.Parse(queueId)); Session["queueEdit"] = q; this.title.Text = q.Queue_Name; this.description.Text = q.Queue_Description; this.initiatorAlias.Text = q.Queue_OwnerName; this.minuit.Checked = q.Queue_ResetAtMidnight; this.ticketsmaxopt.Checked = q.Queue_ResetAtMaxReached; if (q.Queue_MaxLimit != null) this.ticketsmax.Text = q.Queue_MaxLimit.ToString(); if (q.Queue_ValidTillDate != null) { this.desactivateDate.Text = q.Queue_ValidTillDate.ToString(); this.desactiverqueue.Checked = true; } this.editQueue.InnerHtml = "Edit the queue "; if (!q.Queue_IsActive) this.editQueue.InnerHtml += "(Currently disabled)"; } } WizardQueue.PreRender += new EventHandler(Wizard1_PreRender); }
protected void Page_Load(object sender, EventArgs e) { string qID = Request.QueryString["id"]; if (!string.IsNullOrEmpty(qID)) { try { Guid qGUI = Guid.Parse(qID); HelperClass_Queue hcq = new HelperClass_Queue(); HelperClass_Ticket hct = new HelperClass_Ticket(); Queue q = hcq.GetQueue(qGUI); if (q.Queue_Current_Ticket_ID == null) return; Ticket t = hct.GetTicket((Guid)q.Queue_Current_Ticket_ID); this.lblEmail.Text = t.Ticket_Email; this.lblNumero.Text = t.Ticket_Increment.ToString(); this.lblPwd.Text = t.Ticket_Password; } catch { } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string qID = Request.QueryString["id"]; if (!string.IsNullOrEmpty(qID)) { try { Guid qGUI = Guid.Parse(qID); HelperClass_Queue hcq = new HelperClass_Queue(); Queue q = hcq.GetQueue(qGUI); if (!string.IsNullOrEmpty(q.Queue_Address)) { HelperClass_Map hcm = new HelperClass_Map(); try { geoloc gl = hcm.GeocodeAddress(q.Queue_Address); Session["lat"] = gl.lat; Session["lon"] = gl.lon; this.divMap.Visible = true; this.addressNotFound.Visible = false; return; } catch { this.addressNotFound.Visible = true; } } } catch { } } this.divMap.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { string qID = Request.QueryString["id"]; string showDetails = Request.QueryString["showDetails"]; if (!string.IsNullOrEmpty(qID)) { try { Guid qGUI = Guid.Parse(qID); HelperClass_Queue hcq = new HelperClass_Queue(); HelperClass_Ticket hct = new HelperClass_Ticket(); Queue q = hcq.GetQueue(qGUI); this.queueName.InnerText = q.Queue_Name; if (q.Queue_Current_Ticket_ID != null) this.currentTicketNumber.InnerText = hct.GetTicket((Guid)q.Queue_Current_Ticket_ID).Ticket_Increment.ToString(); else this.currentTicketNumber.InnerText = "--"; if (q.Queue_ExpectedHandlingTime != null) this.expectedHandlingTime.InnerText = "Estimated processing time per ticket: " + q.Queue_ExpectedHandlingTime.ToString() + " min."; this.invalidQueue.Visible = false; this.TicketDetails.Visible = false; this.activeDateOver.Visible = false; if (showDetails == "1") { if (q.Queue_UserID == (Guid)Membership.GetUser().ProviderUserKey) { this.TicketDetails.Visible = true; } } if (!hcq.IsActive(q)) this.activeDateOver.Visible = true; return; } catch { } } this.invalidQueue.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { string qID = Request.QueryString["id"]; if (!string.IsNullOrEmpty(qID)) { Guid qGUI = Guid.Parse(qID); HelperClass_Queue hcq = new HelperClass_Queue(); Queue q = hcq.GetQueue(qGUI); if (q.Queue_UserID == (Guid)Membership.GetUser().ProviderUserKey) { this.invalidQueue.Visible = false; return; } } this.invalidQueue.Visible = true; this.adminDiv.Visible = false; }
public Ticket GenerateNextTicket(Guid queueID, string email) { Random random = new Random(); Ticket ticket = new Ticket(); HelperClass_Queue hcq = new HelperClass_Queue(); Queue queue = hcq.GetQueue(queueID); try { if (!hcq.IsActive(queue)) throw new Exception("This queue isn't active; no ticket can be created."); ticket.Ticket_ID = System.Guid.NewGuid(); FreeQ_DBEntities db = new FreeQ_DBEntities(); ticket.Ticket_UniversalIncrement = (from q in db.Ticket select q.Ticket_UniversalIncrement).Max() + 1; if (ticket.Ticket_UniversalIncrement == null) ticket.Ticket_UniversalIncrement = ticket.Ticket_Increment + 1; ticket.Ticket_Increment = queue.Queue_Next_Increment; ticket.Ticket_Password = random.Next(1000).ToString(); ticket.Ticket_Queue_ID = queueID; ticket.Ticket_Email = email; ticket.Ticket_StateID = 1; ticket.Ticket_CreationDate = DateTime.Now; db.Ticket.AddObject(ticket); int result = db.SaveChanges(); hcq.NextIncrement(ticket.Ticket_ID, queueID); } catch { } return ticket; }
protected void WizardQueue_FinishButtonClick(object sender, WizardNavigationEventArgs e) { Queue q = new Queue(); if (Session["queueEdit"] != null) q = (Queue)Session["queueEdit"]; q.Queue_Name = this.title.Text; q.Queue_Address = this.location.Text; q.Queue_Description = this.description.Text; q.Queue_OwnerName = this.initiatorAlias.Text; q.Queue_ResetAtMidnight = this.minuit.Checked; q.Queue_ResetAtMaxReached = this.ticketsmaxopt.Checked; if (!string.IsNullOrEmpty(this.handlingTime.Text)) q.Queue_ExpectedHandlingTime = int.Parse(this.handlingTime.Text); if (this.ticketsmaxopt.Checked) q.Queue_MaxLimit = int.Parse(this.ticketsmax.Text); if (this.desactiverqueue.Checked) q.Queue_ValidTillDate = DateTime.Parse(this.desactivateDate.Text); q.Queue_Next_Increment = 1; q.Queue_IsActive = true; q.Queue_UserID = (Guid)Membership.GetUser().ProviderUserKey; HelperClass_Queue hcq = new HelperClass_Queue(); if (Session["queueEdit"] == null) { q.Queue_IsActive = true; q = hcq.CreateQueue(q); } else hcq.UpdateQueue(q); Session["NewQueue"] = q.Queue_ID; this.Response.Redirect(Page.ResolveUrl("~/Queues/Confirmation.aspx")); }
public void ValidateCurrentTicket(Guid queueID, bool cancel) { Queue queue = null; try { FreeQ_DBEntities db = new FreeQ_DBEntities(); queue = this.GetQueue(db, queueID); HelperClass_Ticket hct = new HelperClass_Ticket(); HelperClass_Queue hcq = new HelperClass_Queue(); if (!hcq.IsActive(queue)) throw new Exception("This queue isn't active; you can't handle tickets anymore."); if (queue.Queue_Current_Ticket_ID == null) { List<Ticket> tickets = (from t in db.Ticket where t.Ticket_Queue_ID == queueID orderby t.Ticket_ID select t).ToList<Ticket>(); if (tickets.Count > 0) queue.Queue_Current_Ticket_ID = tickets[0].Ticket_ID; } else { Ticket t = hct.GetTicket(db, (Guid)queue.Queue_Current_Ticket_ID); if (t == null) return; if (cancel) t.Ticket_StateID = 3; else t.Ticket_StateID = 2; List<Ticket> tickets = (from ti in db.Ticket where ti.Ticket_Queue_ID == queueID && ti.Ticket_UniversalIncrement > t.Ticket_UniversalIncrement orderby ti.Ticket_ID select ti). ToList<Ticket>(); if (tickets.Count > 0) queue.Queue_Current_Ticket_ID = tickets[0].Ticket_ID; } int result = db.SaveChanges(); // Send alert Ticket ct = hct.GetTicket(db, (Guid)queue.Queue_Current_Ticket_ID); List<Ticket> nextTicket = (from ti in db.Ticket where ti.Ticket_Queue_ID == queueID && ti.Ticket_UniversalIncrement == ct.Ticket_UniversalIncrement + 2 orderby ti.Ticket_ID select ti).ToList<Ticket>(); if (nextTicket.Count == 1 && !String.IsNullOrEmpty(nextTicket[0].Ticket_Email)) { HelperClass_Email.SendEmail(nextTicket[0].Ticket_Email, "Quddle - it is almost your turn!", "Hey, only 2 persons are in front of you ; it is time to go..."); } } catch { } }