public DataTable GetVehicleTypes(VehicleType_ML ml) { try { var DataDic = new Dictionary<string, object>(); return new DBAccessController().RetriveRecordsWithPara(StoredProcedures.sp_GetVehicleTypes, DataDic); } catch { throw; } }
protected void btnUpdate_ServerClick(object sender, EventArgs e) { try { var ml = new VehicleType_ML(gridVehicleTypes.GetSelectedFieldValues("VehicleTypeID")[0].ToString(), txtName.Text); new VehicleType_BL().UpdateVehicletype(ml); GetVehicleTypes(); } catch (Exception) { throw; } }
private void BindModels() { try { var ml = new VehicleType_ML(); ddlModel.DataTextField = "Model"; ddlModel.DataValueField = "Model"; ddlModel.DataSource = new Policy_BL().GetAllModels(); ddlModel.DataBind(); } catch (Exception) { throw; } }
private void BindTypes() { try { var ml = new VehicleType_ML(); ddlType.DataTextField = "VehicleTypeName"; ddlType.DataValueField = "VehicleTypeID"; ddlType.DataSource = new VehicleType_BL().GetVehicleTypes(ml); ddlType.DataBind(); } catch (Exception) { throw; } }
public bool DeleteVehicletype(VehicleType_ML ml) { try { var DataDic = new Dictionary<string, object> { {"@Id", ml.VehicleTypeID} }; return new DBAccessController().DeleteRecord(StoredProcedures.sp_RemoveVehicleType, DataDic); } catch (Exception) { throw; } }
protected void btnSave_ServerClick(object sender, EventArgs e) { try { var ml = new VehicleType_ML() { VehicleType = txtName.Text }; new VehicleType_BL().AddVehicletype(ml); GetVehicleTypes(); } catch (Exception) { throw; } }
private void GetVehicleTypes() { try { var ml = new VehicleType_ML() { }; gridVehicleTypes.DataSource = new VehicleType_BL().GetVehicleTypes(ml); gridVehicleTypes.DataBind(); } catch (Exception) { throw; } }
public bool UpdateVehicletype(VehicleType_ML ml) { try { var DataDic = new Dictionary<string, object> { {"@Id", ml.VehicleTypeID}, {"@VehicleTypeName", ml.VehicleType} }; return new DBAccessController().InsertRecord(StoredProcedures.sp_UpdateVehicleType, DataDic); } catch (Exception) { throw; } }
public DataTable GetVehicleTypes(VehicleType_ML ml) { DataTable dt = new DataTable(); try { con = new SqlConnection(connectionString); con.Open(); cmd = new SqlCommand("[sp_GetVehicleTypes]", con) { CommandType = CommandType.StoredProcedure }; adp = new SqlDataAdapter(cmd); adp.Fill(dt); return dt; } catch (SqlException ex) { return dt; } finally { con.Close(); con.Dispose(); } }
protected void btnDelete_ServerClick(object sender, EventArgs e) { try { if (gridVehicleTypes.Selection.Count > 0) { var ml = new VehicleType_ML() { VehicleTypeID = (Int32)gridVehicleTypes.GetSelectedFieldValues("VehicleTypeID")[0] }; new VehicleType_BL().DeleteVehicletype(ml); GetVehicleTypes(); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "script", "<script type='text/javascript'>$( document ).ready(function() { $('#SelectErrorModal').modal('show')});</script>", false); } } catch (Exception) { throw; } }