Пример #1
0
        public Object GetClosedTickets([FromBody] BookingDetailsInput bdi)
        {
            OpenTicketOpts mo            = new OpenTicketOpts();
            DataSet        SelectedSlots = new DataSet();
            string         sJSONResponse = "";

            DataTable          dt_MembersTickets = new DataTable();
            List <OpenTickets> bdetails          = new List <OpenTickets>();

            try
            {
                dt_MembersTickets = getdata(string.Format("select TT.MemberShipCode,TT.TicketId,TT.RequestTypeId,TTP.RequestType,TT.Comments,TT.PostPoneDate,TT.InvoiceId,TT.CreatedBy,TT.CreatedOn,TT.StatusId from TicketTransaction TT,TicketTypes TTP where  TT.ID=TTP.ID and BranchCode='{0}' and StatusId=2", bdi.BranchCode));

                for (int i = 0; i < dt_MembersTickets.Rows.Count; i++)
                {
                    OpenTickets fd = new OpenTickets {
                        memberShipCode = dt_MembersTickets.Rows[0]["MemberShipCode"].ToString(), TicketId = Convert.ToInt32(dt_MembersTickets.Rows[0]["TicketId"].ToString()), RequestTypeId = Convert.ToInt32(dt_MembersTickets.Rows[0]["RequestTypeId"].ToString()), RequestType = dt_MembersTickets.Rows[0]["RequestType"].ToString(), Comments = dt_MembersTickets.Rows[0]["Comments"].ToString(), PostPoneDate = dt_MembersTickets.Rows[0]["PostPoneDate"].ToString(), InvoiceId = dt_MembersTickets.Rows[0]["InvoiceId"].ToString(), CreatedBy = dt_MembersTickets.Rows[0]["CreatedBy"].ToString(), CreatedOn = Convert.ToDateTime(dt_MembersTickets.Rows[0]["CreatedOn"].ToString()), StatusId = Convert.ToInt32(dt_MembersTickets.Rows[0]["StatusId"].ToString())
                    };
                    bdetails.Add(fd);
                }

                mo.status     = "success";
                mo.value      = bdetails;
                sJSONResponse = JsonConvert.SerializeObject(mo);
            }
            catch (Exception ec)
            {
                mo.status     = "fail";
                sJSONResponse = JsonConvert.SerializeObject(mo);
            }
            return(sJSONResponse);
        }
Пример #2
0
        public void UpdateOpenTickets(Department department, string selectedTag)
        {
            Expression <Func <Ticket, bool> > prediction;

            if (department != null)
            {
                prediction = x => !x.IsPaid && x.DepartmentId == department.Id;
            }
            else
            {
                prediction = x => !x.IsPaid;
            }

            OpenTickets = Dao.Select(x => new TerminalOpenTicketView
            {
                Id           = x.Id,
                TicketNumber = x.TicketNumber,
                LocationName = x.LocationName,
                CustomerName = x.CustomerName,
                IsLocked     = x.Locked,
                TicketTag    = x.Tag
            }, prediction).OrderBy(x => x.Title);

            if (!string.IsNullOrEmpty(selectedTag))
            {
                var tag = selectedTag.ToLower() + ":";
                var cnt = OpenTickets.Count(x => string.IsNullOrEmpty(x.TicketTag) || !x.TicketTag.ToLower().Contains(tag));

                OpenTickets = OpenTickets.Where(x => !string.IsNullOrEmpty(x.TicketTag) && x.TicketTag.ToLower().Contains(tag));

                var opt = OpenTickets.SelectMany(x => x.TicketTag.Split('\r'))
                          .Where(x => x.ToLower().Contains(tag))
                          .Distinct()
                          .Select(x => x.Split(':')).Select(x => new TicketTagFilterViewModel {
                    TagGroup = x[0], TagValue = x[1]
                }).OrderBy(x => x.TagValue).ToList();

                opt.Insert(0, new TicketTagFilterViewModel {
                    TagGroup = selectedTag, TagValue = "*", ButtonColor = "Blue"
                });

                if (cnt > 0)
                {
                    opt.Insert(0, new TicketTagFilterViewModel {
                        Count = cnt, TagGroup = selectedTag, ButtonColor = "Red"
                    });
                }

                OpenTicketTags = opt.Count() > 1 ? opt : null;

                OpenTickets.ForEach(x => x.Info = x.TicketTag.Split('\r').Where(y => y.ToLower().StartsWith(tag)).Single().Split(':')[1]);
            }
            else
            {
                OpenTicketTags = null;
            }
        }
Пример #3
0
        /// <summary>
        /// Try to handle all open tickets. After calling this method, it should hold that:
        /// 1) No tickets are in the Open list
        /// 2) Tickets successfully handled are in the Closed list
        /// 3) Tickets unsuccessfully handled are in the Unhandled list
        /// </summary>
        public void HandleOpenTickets()
        {
            while (OpenTicketCount > 0)
            {
                // Take a ticket from the list
                ErrorTicket ticket = OpenTickets[OpenTicketCount - 1];
                OpenTickets.RemoveAt(OpenTicketCount - 1);

                // Try to handle it
                TryHandleTicket(ticket);
            }
        }