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