Пример #1
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)));
        }
        public override void HandleDelete()
        {
            try
            {
                if (CheckPermission())
                {
                    var ticket = _ticketBusiness.Get(lblTicketId.Text);
                    if (ticket == null)
                    {
                        ShowErrorMessageBox(Constants.Messages.MSG_TICKET_DELETE_TICKET_NOT_EXIST_MSG);
                        return;
                    }

                    decimal returnFee = _ticketReturnFeeConfigurationBusiness.GetReturnFee(ticket, DateTime.Now);

                    StringBuilder message = new StringBuilder();
                    message.Append(Constants.Messages.MSG_TICKET_DELETE_TICKET_CONFIRM_MSG);
                    if (returnFee > 0)
                    {
                        message.AppendLine("\r\n").AppendLine(string.Format(Constants.Messages.MSG_TICKET_RETURN_TICKET_FEE_MSG, CurrencyUtil.ToString(returnFee)));
                    }

                    if (MessageBox.Show(message.ToString(), Constants.Messages.INFO_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        string result = string.Empty;
                        if (returnFee > 0)
                        {
                            result = _ticketBusiness.Cancel(ticket, returnFee);
                        }
                        else
                        {
                            result = _ticketBusiness.Delete(ticket);
                        }

                        if (string.IsNullOrEmpty(result))
                        {
                            ShowInformationMessage(Constants.Messages.MSG_TICKET_DELETE_TICKET_SUCCESS_MSG);
                        }
                        else
                        {
                            ShowErrorMessageBox(result);
                        }
                        LoadSeatMapData();
                    }
                }
                else
                {
                    ShowErrorMessageBox(Constants.Messages.MSG_TICKET_INSUFFICIENT_PERMISSION);
                }
            }
            catch (Exception ex)
            {
                AppLogger.logError(this.ToString(), Constants.Messages.MSG_TICKET_DELETE_TICKET_EXCEPTION_MSG, ex);
                ShowErrorMessageBox(Constants.Messages.MSG_TICKET_DELETE_TICKET_FAIL_MSG);
            }
        }
        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);
            }
        }