示例#1
0
        private void BindTotalSeats()
        {
            BusTypeController busTypeController = new BusTypeController();
            BusTypeInfo       busTypeInfo       = busTypeController.SelectByBusTypeID(this.cboBusType.SelectedValue.ToString());

            this.cboBusType.SelectedValue = busTypeInfo.BusTypeID;
            this.lblTotalSeat.Text        = Convert.ToString(busTypeInfo.TotalSeats);
        }
示例#2
0
        private void BindDataGridView()
        {
            BusTypeController  busTypeController  = new BusTypeController();
            BusTypeCollections busTypeCollections = busTypeController.SelectList();

            this.dgvBusType.AutoGenerateColumns = false;
            this.dgvBusType.DataSource          = busTypeCollections;
        }
示例#3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                switch (this.btnSave.Text)
                {
                case "&Save":
                    if (CheckRequiredFields())
                    {
                        BusTypeController busTypeController = new BusTypeController();
                        BusTypeInfo       busTypeInfo       = new BusTypeInfo();

                        busTypeInfo.BusTypeID   = this.recordID;
                        busTypeInfo.BusTypeCode = this.txtBusTypeCode.Text.Trim();
                        busTypeInfo.TotalSeats  = Convert.ToInt32(this.txtTotalSeats.Text.Trim());
                        busTypeInfo.Description = this.txtDescription.Text.Trim();
                        busTypeController.Insert(busTypeInfo);
                        string log = "Form-BusType;Item-BusCode:" + this.txtBusTypeCode.Text + ";action-Save";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Saved Successfully");
                    }
                    break;

                case "&Update":
                    if (CheckRequiredFields())
                    {
                        BusTypeController busTypeController = new BusTypeController();
                        BusTypeInfo       busTypeInfo       = new BusTypeInfo();

                        busTypeInfo.BusTypeID   = this.recordID;
                        busTypeInfo.BusTypeCode = this.txtBusTypeCode.Text.Trim();
                        busTypeInfo.TotalSeats  = Convert.ToInt32(this.txtTotalSeats.Text.Trim());
                        busTypeInfo.Description = this.txtDescription.Text.Trim();

                        busTypeController.UpdateByBusTypeID(busTypeInfo);

                        string log = "Form-BusType;Item-BusCode:" + this.txtBusTypeCode.Text + ";action-Update";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Updated Successfully");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }
示例#4
0
        private void BusTypeReport_Load(object sender, EventArgs e)
        {
            BusTypeController Controller = new BusTypeController();

            rpvBusType.LocalReport.DataSources.Clear();
            ReportDataSource rds = new ReportDataSource();

            rds.Name  = "BusTypeDataSet_BusTypeDataTable";
            rds.Value = Controller.SelectList();
            this.rpvBusType.LocalReport.DataSources.Add(rds);

            rpvBusType.ZoomMode = ZoomMode.Percent;
            this.rpvBusType.RefreshReport();
        }
示例#5
0
        private void BindBusType()
        {
            BusTypeController  busTypeController  = new BusTypeController();
            BusTypeCollections busTypeCollections = busTypeController.SelectList();

            BusTypeInfo info = new BusTypeInfo();

            info.Description = " - Select One - ";
            info.BusTypeID   = null;
            busTypeCollections.Insert(0, info);

            this.cboBusType.DisplayMember = "Description";
            this.cboBusType.ValueMember   = "BusTypeID";
            this.cboBusType.DataSource    = busTypeCollections;
        }
示例#6
0
        private void dgvBusType_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            try
            {
                switch (e.ColumnIndex)
                {
                case 0:
                    this.recordID = this.dgvBusType.Rows[e.RowIndex].Cells["BusTypeID"].Value.ToString();

                    this.txtBusTypeCode.Text = this.dgvBusType.Rows[e.RowIndex].Cells["BusTypeCode"].Value.ToString();
                    this.txtDescription.Text = this.dgvBusType.Rows[e.RowIndex].Cells["Description"].Value.ToString();
                    this.txtTotalSeats.Text  = this.dgvBusType.Rows[e.RowIndex].Cells["TotalSeats"].Value.ToString();

                    this.btnSave.Text = "&Update";
                    break;

                case 1:
                    if (Globalizer.ShowMessage(MessageType.Question, "Are you sure want to delete?") == DialogResult.Yes)
                    {
                        recordID = this.dgvBusType.Rows[e.RowIndex].Cells["BusTypeID"].Value.ToString();
                        BusTypeController busTypeController = new BusTypeController();

                        busTypeController.DeleteByBusTypeID(recordID);

                        string log = "Form-BusType;Item-BusCode:" + this.txtBusTypeCode.Text + ";action-Delete";
                        userAction.Log(log);

                        this.InitializeControls();
                        this.BindDataGridView();
                        Globalizer.ShowMessage(MessageType.Information, "Deleted Successfully");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Globalizer.ShowMessage(MessageType.Critical, ex.Message);
            }
        }