public static TicketCounts[] GetData()
    {
        List <TicketCounts> result = new List <TicketCounts>();

        TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);

        ticketTypes.LoadByOrganizationID(UserSession.LoginUser.OrganizationID, UserSession.CurrentUser.ProductType);

        Users users = new Users(UserSession.LoginUser);

        users.LoadByOrganizationID(UserSession.LoginUser.OrganizationID, true);

        foreach (User user in users)
        {
            string value = user.DisplayName;
            int    count = 0;

            foreach (TicketType ticketType in ticketTypes)
            {
                count += Tickets.GetUserOpenTicketCount(UserSession.LoginUser, user.UserID, ticketType.TicketTypeID);
            }

            TicketCounts counts = new TicketCounts();
            counts.Name  = value;
            counts.Count = count;
            result.Add(counts);
        }


        return(result.OrderBy(ticketcount => ticketcount.Name).ToArray());
    }
Esempio n. 2
0
        public Object GetTicketTypes([FromBody] SupportInput si)
        {
            TicketTypeOpt fdop          = new TicketTypeOpt();
            DataSet       SelectedSlots = new DataSet();
            string        sJSONResponse = "";

            DataTable dt_TicketTypes = new DataTable();

            List <TicketTypes> ttdetails = new List <TicketTypes>();

            try
            {
                dt_TicketTypes = getdata(string.Format("Select ID,RequestType from TicketTypes"));

                for (int i = 0; i < dt_TicketTypes.Rows.Count; i++)
                {
                    TicketTypes fd = new TicketTypes {
                        ID = dt_TicketTypes.Rows[i]["ID"].ToString(), RequestType = dt_TicketTypes.Rows[i]["RequestType"].ToString()
                    };
                    ttdetails.Add(fd);
                }

                fdop.status   = "success";
                fdop.value    = ttdetails;
                sJSONResponse = JsonConvert.SerializeObject(fdop);
            }
            catch (Exception ec)
            {
                fdop.status   = "fail";
                sJSONResponse = JsonConvert.SerializeObject(fdop);
            }
            return(sJSONResponse);
        }
Esempio n. 3
0
        private void SaveDrawDates(int year, TicketTypes ticketTypeId)
        {
            var lotteryDrawDates = new List <DayOfWeek>();

            switch (ticketTypeId)
            {
            case TicketTypes.Powerball:
                lotteryDrawDates.Add(DayOfWeek.Wednesday);
                lotteryDrawDates.Add(DayOfWeek.Saturday);
                break;

            case TicketTypes.MegaMillions:
                lotteryDrawDates.Add(DayOfWeek.Tuesday);
                lotteryDrawDates.Add(DayOfWeek.Friday);
                break;

            default:
                break;
            }
            ;

            var drawDates = GetDrawDates(year, lotteryDrawDates);

            foreach (var d in drawDates)
            {
                repo.SaveDrawDate(new LotteryDrawDate
                {
                    TicketTypeId    = (int)ticketTypeId,
                    DrawDate        = Convert.ToDateTime(d.Key),
                    DisplayDrawDate = d.Value,
                });
            }
        }
Esempio n. 4
0
        public void ParseCommand(string command)
        {
            bool status = int.TryParse(command, out int commandNumber);

            if (!status)
            {
                return;
            }

            if (!Enum.IsDefined(typeof(Commands), commandNumber))
            {
                commandNumber = (int)Commands.buyTicket;
            }

            switch ((Commands)commandNumber)
            {
            case Commands.exit:
                Environment.Exit(0);
                break;

            case Commands.buyTicket:
                string      typeToParse = UserInterface.AskForTicketType();
                TicketTypes type        = ParseType(typeToParse);
                Ticket      ticket      = TicketFactory.CreateTicket(type);

                string    discountToParse   = UserInterface.AskForDiscount();
                Discounts desiredDiscount   = ParseDiscount(discountToParse);
                var       discountDecorator = new DiscountDecorator(ticket, desiredDiscount);

                Logger.LogTicket(discountDecorator);
                UserInterface.PrintingPrompt();
                break;
            }
        }
    public static TicketCounts[] GetData()
    {
        List <TicketCounts> result      = new List <TicketCounts>();
        TicketTypes         ticketTypes = new TicketTypes(UserSession.LoginUser);

        ticketTypes.LoadByOrganizationID(UserSession.LoginUser.OrganizationID, UserSession.CurrentUser.ProductType);

        foreach (TicketType ticketType in ticketTypes)
        {
            int    count = Tickets.GetUserOpenTicketCount(UserSession.LoginUser, UserSession.LoginUser.UserID, ticketType.TicketTypeID);
            string value = ticketType.Name;
            if (value.Length > 8)
            {
                value = value.Substring(0, 8);
            }
            value = value + " (" + count.ToString() + ")";
            TicketCounts counts = new TicketCounts();
            counts.Name  = value;
            counts.Count = count;
            result.Add(counts);
        }


        return(result.ToArray());
    }
Esempio n. 6
0
    private void LoadEAICombos()
    {
        RadComboBox combo  = wndAltEmail.ContentContainer.FindControl("cmbEAIGroup") as RadComboBox;
        Groups      groups = new Groups(UserSession.LoginUser);

        groups.LoadByOrganizationID(UserSession.LoginUser.OrganizationID);
        combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Unassigned", "-1"));
        foreach (Group group in groups)
        {
            combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem(group.Name, group.GroupID.ToString()));
        }
        combo.SelectedIndex = 0;

        combo = wndAltEmail.ContentContainer.FindControl("cmbEAITicket") as RadComboBox;
        TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);

        ticketTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
        combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Unassigned", "-1"));
        foreach (TicketType ticketType in ticketTypes)
        {
            combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem(ticketType.Name, ticketType.TicketTypeID.ToString()));
        }
        combo.SelectedIndex = 0;

        combo = wndAltEmail.ContentContainer.FindControl("cmbEAIProduct") as RadComboBox;
        Products products = new Products(UserSession.LoginUser);

        products.LoadByOrganizationID(UserSession.LoginUser.OrganizationID);
        combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Unassigned", "-1"));
        foreach (Product product in products)
        {
            combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem(product.Name, product.ProductID.ToString()));
        }
        combo.SelectedIndex = 0;
    }
Esempio n. 7
0
        public IActionResult Buy(int id)
        {
            UserAccounts u = Autentification.GetLoggedUser(HttpContext);

            if (u == null)
            {
                return(RedirectToAction("Index", "Autentification"));
            }

            else
            {
                Tickets ticket = new Tickets();
                ticket.TicketTypeId = id;

                TicketTypes type = tickettypeRepository.GetType(id);

                ticket.Date     = DateTime.Now;
                ticket.Quantity = 1;
                ticket.Seen     = false;
                ticket.Active   = false;
                ticket.Code     = "";
                ticket.ClientId = clientRepository.GetClientByUserId(u.Id).Id;
                ticket.Quantity = 1;
                ticket.Total    = type.Price;

                ViewData["type"]  = type.Type;
                ViewData["total"] = ticket.Total * 100;


                return(View("Buy", ticket));
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             _productID = int.Parse(Request["tf_ProductID"]);
             if (Request["tf_SolvedVersionID"] != null)
             {
                 _resolvedVersionID = int.Parse(Request["tf_SolvedVersionID"]);
             }
             if (Request["tf_ReportedVersionID"] != null)
             {
                 _reportedVersionID = int.Parse(Request["tf_ReportedVersionID"]);
             }
             int        ticketTypeID = int.Parse(Request["tf_TicketTypeID"]);
             TicketType ticketType   = (TicketType)TicketTypes.GetTicketType(UserSession.LoginUser, ticketTypeID);
             if (ticketType.OrganizationID != UserSession.LoginUser.OrganizationID)
             {
                 throw new Exception("Unauthorized ticket type.");
             }
             CreateTabButtons(ticketType);
             tsMain.SelectedIndex           = Settings.UserDB.ReadInt("SelectedOrganizationTicketTabIndex" + Request.Url, 0);
             ticketsFrame.Attributes["src"] = tsMain.SelectedTab.Value;
         }
         catch (Exception ex)
         {
             Response.Write("Invalid Ticket Type: " + ex.Message);
             Response.End();
         }
     }
 }
Esempio n. 9
0
 public IEnumerable <EntityType> GetEntityTypesByTicketType(int ticketTypeId)
 {
     return(TicketTypes.Single(x => x.Id == ticketTypeId)
            .EntityTypeAssignments
            .OrderBy(x => x.SortOrder)
            .Select(x => GetEntityTypeById(x.EntityTypeId)));
 }
Esempio n. 10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] TicketTypes ticketTypes)
        {
            if (id != ticketTypes.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ticketTypes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TicketTypesExists(ticketTypes.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ticketTypes));
        }
Esempio n. 11
0
        public Ticket CreateTicket(TicketTypes type)
        {
            Ticket ticketToReturn;

            switch (type)
            {
            case TicketTypes.oneWay:
                string line = UserInterface.AskForLine();
                ticketToReturn = new OneWayTicket(line);
                break;

            case TicketTypes.hourly:
                ticketToReturn = new HourTicket();
                break;

            case TicketTypes.monthly:
                string dateToParse = UserInterface.AskForStartDate();
                var    parsedDate  = Parser.ParseDate(dateToParse);
                ticketToReturn = new MonthlyTicket(parsedDate);
                break;

            default:
                ticketToReturn = new HourTicket();
                break;
            }
            return(ticketToReturn);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            TicketTypes ticketTypes = db.TicketTypes.Find(id);

            db.TicketTypes.Remove(ticketTypes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public string GetData()
        {
            TicketsView tickets     = new TicketsView(_command.LoginUser);
            TicketTypes ticketTypes = new TicketTypes(_command.LoginUser);

            ticketTypes.LoadAllPositions(_command.Organization.OrganizationID);
            TicketType   ticketType = null;
            CustomFields customFields;
            string       elementName = "Ticket";

            switch (_restTicketType)
            {
            case RestTicketType.Bug:
                elementName = "Bug";
                ticketType  = ticketTypes.FindByName("Bugs");
                break;

            case RestTicketType.Feature:
                elementName = "Feature";
                ticketType  = ticketTypes.FindByName("Features");
                break;

            case RestTicketType.Task:
                elementName = "Task";
                ticketType  = ticketTypes.FindByName("Tasks");
                break;

            case RestTicketType.Issue:
                elementName = "Issue";
                ticketType  = ticketTypes.FindByName("Issues");
                break;

            default:
                break;
            }

            if (ticketType == null)
            {
                tickets.LoadByOrganizationID(_command.Organization.OrganizationID);
                customFields = null;
            }
            else
            {
                tickets.LoadByTicketTypeID(ticketType.TicketTypeID);
                customFields = new CustomFields(_command.LoginUser);
                customFields.LoadByTicketTypeID(_command.Organization.OrganizationID, ticketType.TicketTypeID);
            }

            RestXmlWriter writer = new RestXmlWriter(elementName + "s");

            foreach (TicketsViewItem ticket in tickets)
            {
                writer.XmlWriter.WriteStartElement(elementName);
                RestTicketsViewItem.WriteTicketsViewItemXml(_command, writer.XmlWriter, ticket, customFields);
                writer.XmlWriter.WriteEndElement();
            }
            return(writer.GetXml());
        }
 public ActionResult Edit([Bind(Include = "Id,TypeName,Description")] TicketTypes ticketTypes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ticketTypes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ticketTypes));
 }
Esempio n. 15
0
        public IActionResult Add()
        {
            TicketTypes model = new TicketTypes();

            int id = Autentification.GetLoggedUser(HttpContext).Id;

            model.MuseumId = museumRepository.GetMuseumByAccId(id).Id;

            return(View("Add", model));
        }
Esempio n. 16
0
        public static string GetTicketType(RestCommand command, int ticketTypeID)
        {
            TicketType ticketType = TicketTypes.GetTicketType(command.LoginUser, ticketTypeID);

            if (ticketType.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(ticketType.GetXml("TicketType", true));
        }
        public ActionResult Create([Bind(Include = "Id,TypeName,Description")] TicketTypes ticketTypes)
        {
            if (ModelState.IsValid)
            {
                db.TicketTypes.Add(ticketTypes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ticketTypes));
        }
Esempio n. 18
0
        private Ticket(uint level, TicketTypes invokeType, int lifeTime, Vector2I position)
        {
            this.Position   = position;
            this.Level      = level;
            this.InvokeType = invokeType;
            this.LifeTime   = lifeTime;

            Chunk = CreateChunk();

            OnCreation?.Invoke(this);
        }
Esempio n. 19
0
        public void IsWeekendTicketCommand(SelectionChangedEventArgs e)
        {
            TicketType currentTicket = null;

            currentTicket = TicketTypes.Where(x => x.TicketTypeID == InvoiceCreate.TicketTypeID).SingleOrDefault();
            if (currentTicket == null)
            {
                WeekendTicket = false;
            }
            WeekendTicket = (currentTicket.OnFriday == true);
        }
Esempio n. 20
0
        public async Task <IActionResult> Create([Bind("Id,Name")] TicketTypes ticketTypes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ticketTypes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ticketTypes));
        }
Esempio n. 21
0
 public override void SetModel(dynamic entity)
 {
     try
     {
         TicketTypes data = (TicketTypes)entity;
         BindingFromModel(data, this);
     }
     catch (Exception ex)
     {
         setErrortoModel(this, ex);
     }
 }
Esempio n. 22
0
        private static void ConfirmBaseData(LoginUser loginUser)
        {
            Organization organization = (Organization)Organizations.GetOrganization(loginUser, loginUser.OrganizationID);
            TicketTypes  types        = new TicketTypes(loginUser);

            types.LoadAllPositions(loginUser.OrganizationID);

            if (types.IsEmpty)
            {
                Organizations.CreateStandardData(loginUser, organization, true, true);
            }
        }
Esempio n. 23
0
        public IActionResult Edit(TicketTypes model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Edit", model));
            }

            tickettypeRepository.UpdateType(model);
            tickettypeRepository.Save();

            return(RedirectToAction("Index"));
        }
    public static ComboBoxItem[] GetTicketTypes(int ticketTemplateID)
    {
        TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);

        ticketTypes.LoadByTicketTemplate(UserSession.LoginUser.OrganizationID, ticketTemplateID);
        List <ComboBoxItem> result = new List <ComboBoxItem>();

        foreach (TicketType ticketType in ticketTypes)
        {
            result.Add(new ComboBoxItem(ticketType.Name, ticketType.TicketTypeID));
        }
        return(result.ToArray());
    }
Esempio n. 25
0
    private void LoadCharts(int organizationID)
    {
        TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);

        ticketTypes.LoadByOrganizationID(UserSession.LoginUser.OrganizationID, UserSession.CurrentUser.ProductType);

        DataTable table = new DataTable();

        table.Columns.Add("TicketType");
        table.Columns.Add("Count", Type.GetType("System.Int32"));

        int total = 0;

        foreach (TicketType ticketType in ticketTypes)
        {
            int count = Tickets.GetOrganizationOpenTicketCount(UserSession.LoginUser, organizationID, ticketType.TicketTypeID);
            total += count;
            if (count > 0)
            {
                table.Rows.Add(new string[] { ticketType.Name, count.ToString() });
            }
        }

        chartOpenTickets.ChartTitle.TextBlock.Text = total.ToString() + " Open Tickets";
        chartOpenTickets.DataSource = table;
        chartOpenTickets.DataBind();
        chartOpenTickets.Series[0].Appearance.LabelAppearance.Distance           = 20;
        chartOpenTickets.Series[0].Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 6);

        table = new DataTable();
        table.Columns.Add("TicketType");
        table.Columns.Add("Count", Type.GetType("System.Int32"));

        total = 0;

        foreach (TicketType ticketType in ticketTypes)
        {
            int count = Tickets.GetOrganizationClosedTicketCount(UserSession.LoginUser, organizationID, ticketType.TicketTypeID);
            total += count;
            if (count > 0)
            {
                table.Rows.Add(new string[] { ticketType.Name, count.ToString() });
            }
        }

        chartClosedTickets.ChartTitle.TextBlock.Text = total.ToString() + " Closed Tickets";
        chartClosedTickets.DataSource = table;
        chartClosedTickets.DataBind();
        chartClosedTickets.Series[0].Appearance.LabelAppearance.Distance           = 20;
        chartClosedTickets.Series[0].Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 6);
    }
Esempio n. 26
0
        public static string GetTicketTypes(RestCommand command, bool orderByDateCreated = false)
        {
            TicketTypes items = new TicketTypes(command.LoginUser);

            if (orderByDateCreated)
            {
                items.LoadByOrganizationID(command.Organization.OrganizationID, "DateCreated DESC");
            }
            else
            {
                items.LoadByOrganizationID(command.Organization.OrganizationID);
            }
            return(items.GetXml("TicketTypes", "TicketType", true, command.Filters));
        }
        // GET: TicketType/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TicketTypes ticketTypes = db.TicketTypes.Find(id);

            if (ticketTypes == null)
            {
                return(HttpNotFound());
            }
            return(View(ticketTypes));
        }
Esempio n. 28
0
    private void LoadTicketTypes()
    {
        cmbTicketTypes.Items.Clear();
        TicketTypes types = new TicketTypes(UserSession.LoginUser);

        types.LoadByOrganizationID(UserSession.LoginUser.OrganizationID, UserSession.CurrentUser.ProductType);
        foreach (TicketType type in types)
        {
            cmbTicketTypes.Items.Add(new RadComboBoxItem(type.Name, type.TicketTypeID.ToString()));
        }
        if (cmbTicketTypes.Items.Count > 0)
        {
            cmbTicketTypes.SelectedIndex = 0;
        }
    }
Esempio n. 29
0
        public static string GetTicketTypes(RestCommand command)
        {
            TicketTypes ticketTypes = new TicketTypes(command.LoginUser);

            ticketTypes.LoadByOrganizationID(command.Organization.OrganizationID);

            if (command.Format == RestFormat.XML)
            {
                return(ticketTypes.GetXml("TicketTypes", "TicketType", true, command.Filters));
            }
            else
            {
                throw new RestException(HttpStatusCode.BadRequest, "Invalid data format");
            }
        }
Esempio n. 30
0
        private void AddReservation()
        {
            TicketType type = null;

            if (TicketTypes.Count() > 0)
            {
                type = TicketTypes.First();
            }
            Tickets.Add(new Ticket()
            {
                Amount       = 1,
                TicketHolder = "Nieuwe koper",
                Type         = type
            });
        }