コード例 #1
0
 protected void LoadTicketReturnFee()
 {
     using (TicketReturnFeeConfigurationBusiness business = new TicketReturnFeeConfigurationBusiness())
     {
         dgvItemsList.DataSource = business.GetAll();//.OrderByDescending(i => i.before_day).ThenByDescending(i => i.before_hour);
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string errorMessage = ValidInput();
                if (string.IsNullOrEmpty(errorMessage) == false)
                {
                    MessageBox.Show(errorMessage, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                base.btnSave_Click(sender, e);

                using (TicketReturnFeeConfigurationBusiness business = new TicketReturnFeeConfigurationBusiness())
                {
                    TicketReturnFeeConfiguration config = _isUpdating == false
                        ? new TicketReturnFeeConfiguration()
                        : business.Get(tbId.Text);

                    if (config == null)
                    {
                        return;
                    }

                    config.id = _isUpdating == false?IDGenerator.TicketReturnFeeConfigId() : tbId.Text;

                    config.before_day  = int.Parse(tbBeforeDate.Text);
                    config.before_hour = string.IsNullOrEmpty(tbBeforeHour.Text) ? 0 : int.Parse(tbBeforeHour.Text);
                    config.fee_amount  = rbAmount.Checked ? CurrencyUtil.ToDecimal(tbAmount.Text) : 0;
                    config.fee_percent = rbPercent.Checked ? int.Parse(tbPercent.Text) : 0;

                    business.Insert(config);

                    LoadTicketReturnFee();

                    ChangeViewStatus(false);
                }
            }
            catch (Exception exc)
            {
                AppLogger.logError("btnSave_Click", exc);
            }
        }
コード例 #4
0
        protected override void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("Bạn có chắc rằng muốn xóa thiết lập này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
                {
                    using (TicketReturnFeeConfigurationBusiness business = new TicketReturnFeeConfigurationBusiness())
                    {
                        business.Delete(tbId.Text);
                    }

                    LoadTicketReturnFee();
                }
            }
            catch (Exception exc)
            {
                AppLogger.logError("btnDelete_Click", exc);
            }
        }
コード例 #5
0
        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);
            }
        }