Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                // luu xong thi tra ve default. nho check grid count
                if (_flag == 1 && dtGrid.Rows.Count > 0)
                {
                    var _iCenter_ticket_store = new Center_ticket_store();
                    center_ticket_store _center_ticket_store;
                    int _sNum, _eNum;
                    foreach (DataGridViewRow row in dtGrid.Rows)
                    {
                        _sNum = Int32.Parse(row.Cells[3].Value.ToString());
                        _eNum = Int32.Parse(row.Cells[4].Value.ToString());

                        _center_ticket_store = new center_ticket_store()
                        {
                            ticket_serie = row.Cells[2].Value.ToString(),
                            ticket_name  = row.Cells[1].Value.ToString(),
                            //ticket_type = GetTicketId(row.Cells[2].Value.ToString().Trim()).id,
                            ticket_type        = row.Cells[8].Value.ToString(),
                            start_number_serie = _sNum,
                            end_number_serie   = _eNum,
                            date_store         = DateTime.Now,
                            date_out           = DateTime.Now,
                            outForSale         = false,
                            quantity           = _eNum - _sNum + 1,
                            book_number        = (_eNum - _sNum + 1) / 100
                        };
                        if (_iCenter_ticket_store.Add(_center_ticket_store))
                        {
                            lblMsg.Text = SystemMessage.WarningSaveSuccess;
                            _lstTicketStore.Add(_center_ticket_store);
                        }
                        else
                        {
                            break;
                        }
                    }

                    _flag       = 0;
                    btnNew.Text = "Thêm mới";
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 2
0
        private void Frm_InputTicket_Load(object sender, EventArgs e)
        {
            try
            {
                lblMsg.Text = "";
                txtSerieStart.Focus();
                //SplashScreenManager.ShowForm(typeof(FrmSplash));

                #region "load_dataform"
                Center_ticket_type _iCenter_ticket_type = new Center_ticket_type();
                _lstTicketType = _iCenter_ticket_type.GetListTicketType();
                if (_lstTicketType == null)
                {
                    lblMsg.Text = SystemMessage.WarningTableTicketTypeNull;
                    _flag       = -1; // chua nhap du lieu bang tickettype
                    return;
                }

                Center_ticket_store _iCenter_ticket_store = new Center_ticket_store();
                _lstTicketStore = _iCenter_ticket_store.GetListTicketStore();

                _pageTotal = _lstTicketStore.Count();
                if (_pageTotal <= 0)
                {
                    return;
                }
                int p = _pageTotal / _pageSize;
                if (_pageTotal % _pageSize > 0)
                {
                    p++;
                }
                _pageTotal = p;
                FillData(GetPage(_lstTicketStore, _pageNum, _pageSize), _pageNum, _pageSize, _pageTotal);

                #endregion

                //SplashScreenManager.CloseForm();
            }
            catch (Exception ex)
            {
                Console.Write("" + ex);
            }
        }