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); }
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); } }
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; }