Beispiel #1
0
        //
        // GET: /Ticket/

        public ActionResult Index(int?page)
        {
            int pageNumber = (page ?? 1);
            var ticket     = TicketBusiness.Search(String.Empty);

            return(View(ticket.ToPagedList(pageNumber, 3)));
        }
Beispiel #2
0
        public ActionResult Edit(int id)
        {
            Ticket tk = TicketBusiness.Select(id);

            ViewBag.ticketType = new SelectList(TicketTypeBusiness.ListTicketTypes(), "Id", "Description", tk.TypeId);
            return(PartialView("Edit", tk));
        }
Beispiel #3
0
        public ActionResult ListTicket(int?page)
        {
            var ticket     = TicketBusiness.Search(String.Empty);
            int pageNumber = (page ?? 1);

            return(PartialView("ListTicket", ticket.ToPagedList(pageNumber, 3)));
        }
 public CompleteTicketView()
 {
     InitializeComponent();
     _ticketBusiness  = new TicketBusiness(SystemParam.CurrentUser);
     _revenueBusiness = new RevenueBusiness(SystemParam.CurrentUser);
     _expenseBusiness = new ExpenseBusiness(SystemParam.CurrentUser);
 }
Beispiel #5
0
        public ActionResult EditarTicket(int id)
        {
            var entity = TicketBusiness.Create(id);

            TicketModel model = new TicketModel();

            model.TicketEntity = new TicketEntity();
            model.TicketEntity = entity;

            model.TicketAnexoModel = new TicketAnexoModel();
            model.TicketAnexoModel.TicketAnexoEntity = new TicketAnexoEntity()
            {
                TicketId = entity.TicketId
            };
            model.TicketAnexoModel.TicketAnexoList = TicketBusiness.PesquisarAnexoPorTicket(entity.TicketId).ToList();

            model.TicketAndamentoModel = new TicketAndamentoModel();
            model.TicketAndamentoModel.TicketAndamentoEntity = new TicketAndamentoEntity()
            {
                TicketId = entity.TicketId
            };
            model.TicketAndamentoModel.TicketAndamentoList = TicketBusiness.PesquisarAndamentoPorTicket(entity.TicketId, 1).ToList();

            return(View("PrincipalTicket", model));
        }
Beispiel #6
0
        public string CheckTicket(String username, String password, String motorbikePlate)
        {
            // Check username + password
            // If not authenticate, return String.Empty

            #region Check Authentication

            if (!UserService.CheckClientAuthentication(username, password))
            {
                return(null);
            }

            #endregion Check Authentication

            // Done check
            var tmp  = TicketBusiness.SelectTypeByPlate(motorbikePlate);
            var tmp1 = MotorTypeBusiness.SelectMotorTypeByPlate(motorbikePlate);
            if (tmp == null)
            {
                return("Vé ngày");
            }
            else
            {
                return(tmp.Description);
            }
        }
        public string InsertTicket(TTicket ticket, string userId)
        {
            try
            {
                //------------------------------------------------------------//
                // check a valid of Ticket
                //------------------------------------------------------------//
                TicketSaleDateBusiness saleDatebusines = new TicketSaleDateBusiness();
                Ticket newTicket = ThriftUtil.ConvertToEntityObject(ticket) as Ticket;

                string errorMessage = CheckTicketInfo(newTicket);
                errorMessage += saleDatebusines.ValidateDateTime(newTicket.departure_time);

                if (string.IsNullOrEmpty(errorMessage) == false)
                {
                    return(errorMessage);
                }

                TicketBusiness business  = new TicketBusiness();
                string         resultMsg = business.Insert(newTicket);

                ////notify to the others client station
                //ticket.TicketId = ticketId;
                //BroadcastToClient(ClientAction.SellTicket,ticket);

                return(resultMsg);
            }
            catch (Exception exc)
            {
                ServerLogger.logError("[InsertTicket]", exc);
                return(exc.Message);
            }
        }
        public ItemDetailViewModel()
        {
            var _evento = new EventoBusiness().GetEvento(Global.Pedido.IdPedido);

            //Consultas API
            var _ticket        = new TicketBusiness().GetTicketByIdItem(Global.ItemPedido.IdItemPedido);
            var _faixa         = new FaixaEtariaBusiness().GetFaixaEtariaById(_evento.IdFaixaEtaria);
            var _titularTicket = new TitularTicketBusiness().GetTitularTicketById(Global.ItemPedido.IdTitularTicket);

            //Adicionar a FaixaEtaria no evento.
            _evento.FaixaEtaria = _faixa;

            //Adicionar Titular do ticket
            TitularTicket = _titularTicket;

            if (_evento.Status != true)
            {
                _ticket.Status = "ATIVO";
                Ticket         = _ticket;
                Evento         = _evento;
            }
            else
            {
                _ticket.Status = "VENCIDO";
                Ticket         = _ticket;
                Evento         = _evento;
            }
        }
Beispiel #9
0
        public ActionResult Selecionar(int id)
        {
            var entity = TicketBusiness.Create(id);

            //Tem que passar no primeiro parâmetro a View que usamos para fazer o cadastro, se passar a Index, ele irá renderizar a View Index, que espera um model do tipo List.
            //return View("Index",entity);
            return(View(entity));
        }
Beispiel #10
0
        //////////////////////////////////////////////
        //////////////   TICKET ANEXO   //////////////
        //////////////////////////////////////////////

        public ActionResult _TicketAnexo()
        {
            var model = new TicketModel();

            model.TicketEntity = new TicketEntity();
            model.TicketAnexoModel.TicketAnexoEntity.TicketId = model.TicketEntity.TicketId;
            return(View(TicketBusiness.PesquisarAnexoPorTicket(model.TicketEntity.TicketId).ToList()));
        }
Beispiel #11
0
        public ActionResult Delete(Int64 id, int?page)
        {
            TicketBusiness.Delete(id);
            int pageNumber = (page ?? 1);
            var ticket     = TicketBusiness.Search(String.Empty);

            return(PartialView("ListTicket", ticket.ToPagedList(pageNumber, 3)));
        }
Beispiel #12
0
        public ActionResult SalvarArquivo(IEnumerable <HttpPostedFileBase> files, TicketAnexoEntity entity)
        {
            TicketModel      model2 = new TicketModel();
            TicketAnexoModel model  = new TicketAnexoModel();

            model.TicketAnexoEntity = entity;

            if (files != null)
            {
                foreach (var file in files)
                {
                    string fileName = "";

                    string path = Server.MapPath("~/Arquivos/Ticket/Anexo/");
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    // Verify that the user selected a file
                    if (file != null && file.ContentLength > 0)
                    {
                        // extract only the fielname
                        fileName = Path.GetFileNameWithoutExtension(file.FileName) + "-" + entity.TicketId + Path.GetExtension(file.FileName);

                        path = Path.Combine(path, fileName);

                        if (System.IO.File.Exists(path))
                        {
                            path     = GetFileName(path);
                            fileName = Path.GetFileName(path);
                        }
                        file.SaveAs(path);
                        if (ModelState.IsValid)
                        {
                            var entity2 = new TicketAnexoEntity();
                            entity2.TicketId       = entity.TicketId;
                            entity2.Observacao     = entity.Observacao;
                            entity2.CaminhoArquivo = "~/Arquivos/Ticket/Anexo/" + fileName;
                            // entity2.TpArq = Path.GetExtension(fileName);
                            new TicketAnexoBusiness().Salvar(entity2, this.UsuarioId);
                        }
                    }
                }
            }

            model.TicketAnexoEntity = new TicketAnexoEntity()
            {
                TicketId = entity.TicketId
            };
            //context.TicketAnexoEntity.Where(a => a.TicketId == entity.TicketId)
            model.TicketAnexoList = TicketBusiness.PesquisarAnexoPorTicket(entity.TicketId).ToList();

            return(PartialView("_TicketAnexo", model));
        }
Beispiel #13
0
        public ActionResult Edit(Ticket tk, FormCollection collection)
        {
            tk.CustomerId = CustomerBusiness.SelectIdbyName(collection["SearchCustomer"]);
            IFormatProvider iFP = new System.Globalization.CultureInfo("vi-VN", true);

            tk.StartTime = DateTime.Parse(collection["StartTime"], iFP);
            tk.EndTime   = DateTime.Parse(collection["EndTime"], iFP);

            tk.MotorbikePlate = collection["SearchPlate"];
            tk.TypeId         = Int64.Parse(collection["ticketType"]);
            tk.CustomerId     = CustomerBusiness.SelectIdbyName(collection["Customer.FullName"]);
            TicketBusiness.Update(tk);
            ViewBag.ticketType = new SelectList(TicketTypeBusiness.ListTicketTypes(), "Id", "Description", tk.TypeId);
            return(PartialView("Edit", tk));
        }
        public List <TTicket> SyncTicket()
        {
            try
            {
                IEnumerable <TicketHistory> changedTicketId;

                using (ThanhVanTranSysEntities context = new ThanhVanTranSysEntities())
                    using (TicketBusiness business = new TicketBusiness())
                    {
                        changedTicketId = context.TicketHistories
                                          .Where(i => i.changed_date.Year == DateTime.Now.Year && i.changed_date.Month == DateTime.Now.Month && i.changed_date.Day == DateTime.Now.Day)
                                          .OrderBy(i => i.ticket_id).ThenBy(i => i.changed_date);

                        //insert/update records
                        var tickets = (from t in business.GetAll()
                                       join th in changedTicketId on t.id equals th.ticket_id
                                       where t.departure_time >= DateTime.Now
                                       select ThriftUtil.ConvertToTTicket(t, th.action == Constants.DELETE_ACTION)).ToList();

                        //deleted records
                        tickets.AddRange((from th in changedTicketId
                                          where th.action == Constants.DELETE_ACTION
                                          select new TTicket
                        {
                            TicketId = th.ticket_id,
                            BusId = string.Empty,
                            CusIdNo = string.Empty,
                            CusName = string.Empty,
                            CusPhone = string.Empty,
                            DepartTime = DateTime.Now.ToString(),
                            IsDeleted = true,
                            SeatNo = 0,
                            SeatType = string.Empty,
                            Status = string.Empty,
                            TicketPrice = 0,
                            TourId = string.Empty,
                            UserId = string.Empty
                        }));

                        return(tickets);
                    }
            }
            catch (Exception exc)
            {
                ServerLogger.logError("[LoadTicket]", exc);
                return(new List <TTicket>());
            }
        }
Beispiel #15
0
        public ActionResult Create(Ticket tk, FormCollection collection)
        {
            tk.CustomerId = CustomerBusiness.SelectIdbyName(collection["SearchCustomer"]);
            IFormatProvider iFP = new System.Globalization.CultureInfo("vi-VN", true);

            tk.StartTime      = DateTime.Parse(collection["StartTime"], iFP);
            tk.EndTime        = DateTime.Parse(collection["EndTime"], iFP);
            tk.Price          = 0;
            tk.MotorbikePlate = collection["SearchPlate"];
            tk.TypeId         = Int64.Parse(collection["ticketType"]);
            TicketBusiness.Insert(tk);
            IEnumerable <SelectListItem> sList = new SelectList(TicketTypeBusiness.ListTicketTypes(), "Id", "Description");

            ViewBag.TicketType = sList;
            return(PartialView("Create"));
        }
 public List <TTicket> LoadTicket()
 {
     try
     {
         using (TicketBusiness business = new TicketBusiness())
         {
             return(business.GetAll().ToList()
                    .Where(i => i.departure_time >= DateTime.Now)
                    .Select(i => ThriftUtil.ConvertToTTicket(i)).ToList());
         }
     }
     catch (Exception exc)
     {
         ServerLogger.logError("[LoadTicket]", exc);
         return(new List <TTicket>());
     }
 }
Beispiel #17
0
        public ActionResult Search(String sContent, string currentFilter, int?page)
        {
            if (Request.HttpMethod == "GET")
            {
                sContent = currentFilter;
            }
            else
            {
                page = 1;
            }
            ViewBag.CurrentFilter = sContent;
            int pageSize   = 3;
            int pageNumber = (page ?? 1);
            var ticket     = TicketBusiness.Search(sContent);

            return(PartialView("ListTicket", ticket.ToPagedList(pageNumber, pageSize)));
        }
        public SaleTicketView()
        {
            InitializeComponent();

            _ticketBusiness = new TicketBusiness(SystemParam.CurrentUser);
            _ticketPriceConfigurationBusiness     = new TicketPriceConfigurationBusiness();
            _ticketReturnFeeConfigurationBusiness = new TicketReturnFeeConfigurationBusiness();
            _ticketSaleDateBusiness = new TicketSaleDateBusiness();
            _tourBusiness           = new TourBusiness();
            _busBusiness            = new BusBusiness();
            _selectedSeatNumbers    = new List <int>();

            btnSearchSeat.Click   += new EventHandler(btnSearchSeat_Click);
            ucSeatMap.LoadSeatInfo = new SeatMap.LoadSeatInfoDelegate(onSeatMapClick);

            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.GenericView_FormClosed);
        }
        private void LoadSeatMapData()
        {
            ClearTicketInfo();

            _seatClass =
                rbtnUpperSeat.Checked ? Constants.SeatClass.B :
                rbtnLowerSeat.Checked ? Constants.SeatClass.A : Constants.SeatClass.S;
            _busId         = cboBusName.SelectedValue.ToString();
            _tourId        = cboTour.SelectedValue.ToString();
            _departureTime = dtDepartureTime.Value;

            ucSeatMap.InitSeatMap(_seatClass);
            var reservedTickets = new TicketBusiness().GetAll(_busId, _tourId, _seatClass.ToString(), _departureTime).ToList();

            ucSeatMap.LoadTicket(reservedTickets);

            lblPrice.Text = CurrencyUtil.ToString(GetPriceBySeatClass(_seatClass.ToString()));
            _isEmptySeat  = false;
        }
        public string UpdateTicket(TTicket tticket, string userId)
        {
            try
            {
                using (ThanhVanTranSysEntities context = new ThanhVanTranSysEntities())
                {
                    DateTime departTime    = DateTime.Parse(tticket.DepartTime);
                    var      existedTicket = context.Tickets.FirstOrDefault(t => t.bus_id == tticket.BusId &&
                                                                            t.departure_time == departTime &&
                                                                            t.seat_number == tticket.SeatNo &&
                                                                            t.seat_class == tticket.SeatType &&
                                                                            t.tour_id == tticket.TourId);

                    if (existedTicket == null || (existedTicket != null && existedTicket.status == Constants.TicketStatus.Cancel.ToString()))
                    {
                        return(Constants.SERVER_ERROR_CODE_SINGLE_DATA_NOT_SYNC + " Vé đã bị xóa!");
                    }
                }

                if (CheckUserPermission(userId, tticket.UserId) == false)
                {
                    return(Constants.Messages.MSG_TICKET_INSUFFICIENT_PERMISSION);
                }

                TicketBusiness business  = new TicketBusiness();
                Ticket         ticket    = ThriftUtil.ConvertToEntityObject(tticket) as Ticket;
                string         resultMsg = business.Update(ticket);

                //notify to the others client station
                //BroadcastToClient(ClientAction.UpdateTicket,ticket);

                return(resultMsg);
            }
            catch (Exception exc)
            {
                ServerLogger.logError("[UpdateTicket]", exc);
                return(exc.Message);
            }
        }
Beispiel #21
0
        public static void Print(string msg, Dictionary <string, Session> sessionPool, string sendIP)
        {
            string answerMsgType = Convert.ToInt32(TCPMessageType.打印小票).ToString();

            object msgObj        = Utils.DeserializeObject(msg);
            object ticketData    = Utils.GetJsonObjectValue(msgObj, "data");
            object ticketTypeObj = Utils.GetJsonObjectValue(ticketData, "ticketType");

            if (ticketTypeObj != null)
            {
                //获取票据参数
                var data = ((Dictionary <string, object>)ticketData)["ticketData"];
                Dictionary <string, object> dict = TicketBusiness.GetTicketParams(ticketTypeObj.ToString(), (Dictionary <string, object>)data);
                //打印票据
                PrintUtility printUtility = new PrintUtility(dict, SysConfigBusiness.PrinterName);
                printUtility.Print();
            }
            else
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "小票类型不正确");
            }
        }
Beispiel #22
0
        public ActionResult PesquisarAndamento()
        {
            DataTableHelper dataTable = new DataTableHelper();

            int ticketId = Convert.ToInt32(Request.Params["ticketId"].ToString());

            var dados = TicketBusiness.PesquisarAndamentoPorTicket(ticketId, 1);

            int count = 0;

            count = dados.Count();

            var lista = dados.Skip(dataTable.startExibir).Take(dataTable.regExibir).ToList();

            var objeto = new
            {
                iTotalRecords        = count,
                iTotalDisplayRecords = count,

                aaData = lista
            };

            return(Json(objeto, JsonRequestBehavior.AllowGet));
        }
        public string CancelTicket(TTicket tticket, string userId)
        {
            try
            {
                using (TicketReturnFeeConfigurationBusiness _ticketReturnFeeBusiness = new TicketReturnFeeConfigurationBusiness())
                    using (TicketBusiness business = new TicketBusiness())
                    {
                        Ticket cancelTicket = business.Get(tticket.TicketId);

                        if (cancelTicket == null)
                        {
                            return(string.Format("{0} Vé không tồn tại, không thể hủy vé, Mã:{0}", Constants.SERVER_ERROR_CODE_SINGLE_DATA_NOT_SYNC, tticket.TicketId));
                        }

                        string  result    = string.Empty;
                        decimal returnFee = _ticketReturnFeeBusiness.GetReturnFee(cancelTicket, DateTime.Now);
                        if (returnFee > 0)
                        {
                            result = business.Cancel(cancelTicket, returnFee);
                        }
                        else
                        {
                            result = business.Delete(cancelTicket.id);
                        }
                        return(result);
                    }

                //notify to the others client station
                //BroadcastToClient(ClientAction.CancelTicket,tticket);
            }
            catch (Exception exc)
            {
                ServerLogger.logError("[CancelTicket]", exc);
                return(exc.Message);
            }
        }
Beispiel #24
0
 public TicketFacade(string connectionString) : base(connectionString)
 {
     rep = new TicketBusiness(Connection);
 }