protected void btnSave_Click(object sender, EventArgs e) { try { string msg = "Bus Information has been saved."; TblBu obj = new TblBu(); obj.IsNew = true; if (!string.IsNullOrEmpty(hdnBusID.Value)) { obj = new TblBu(hdnBusID.Value); obj.IsNew = false; msg = "Bus Information has been updated."; } obj.RouteID = Convert.ToInt32(ddlRoute.SelectedValue); obj.BusNo = txtBusNo.Text; obj.IsActive = Convert.ToInt32(ddlstatus.SelectedValue); obj.Seats = Convert.ToInt32(txtTotalSeats.Text); obj.Save(); lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, msg, "alert alert-success alert-icon alert-dismissible", icon, "icon mdi mdi-check"); helper.ClearInputs(Page.Controls); hdnBusID.Value = null; } catch (Exception ex) { msgDiv.Visible = true; lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, ex.ToString(), "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-close-circle-o"); lblmsg.Text = ex.ToString(); } loadRptBus(); }
protected void btnDriver_Click(object sender, EventArgs e) { try { LinkButton btn = (LinkButton)sender; TblBu bus = new TblBu(btn.CommandName); txtBusNo1.Text = bus.BusNo.ToString(); hdnBusID.Value = bus.BusID.ToString(); lblDriverPopupHeader.Text = "Add Driver Information"; if (!string.IsNullOrEmpty(btn.CommandArgument)) { TblDriver obj = new TblDriver(btn.CommandArgument); txtDName.Text = obj.DName.ToString(); txtDMobile.Text = obj.DMobile.ToString(); txtDCnic.Text = obj.DCnic.ToString(); txtDAddress.Text = obj.DAddress.ToString(); hdndriverID.Value = obj.Did.ToString(); lblDriverPopupHeader.Text = "Update Driver Information"; } ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalDriver();", true); } catch (Exception ex) { msgDiv.Visible = true; lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, ex.ToString(), "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-close-circle-o"); lblmsg.Text = ex.ToString(); } }
protected void btnEdit_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; hdnBusID.Value = btn.CommandArgument.ToString(); TblBu obj = new TblBu(hdnBusID.Value); txtBusNo.Text = obj.BusNo.ToString(); txtTotalSeats.Text = obj.Seats.ToString(); ddlRoute.SelectedValue = obj.RouteID.ToString(); ddlstatus.SelectedValue = obj.IsActive.ToString(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); }