public bool UpdateManufacturer(Manufacturer_ML ml) { try { try { var DataDic = new Dictionary<string, object> { {"@Id", ml.ManufacturerId}, {"@ManufactureName", ml.ManufacturerName} }; return new DBAccessController().UpdateRecord(StoredProcedures.sp_UpdateManufacturer, DataDic); } catch (Exception) { throw; } } catch (Exception) { throw; } }
private void BindManufacturers() { try { var ml = new Manufacturer_ML() { ManufacturerName = "" }; ddlmanufacturer.DataTextField = "ManufactureName"; ddlmanufacturer.DataValueField = "ManufactureId"; ddlmanufacturer.DataSource = new Manufacturer_BL().GetManufacturers(ml); ddlmanufacturer.DataBind(); } catch (Exception) { throw; } }
public DataTable GetManufacturers(Manufacturer_ML ml) { try { var DataDic = new Dictionary<string, object> { {"@ManufactureName",ml.ManufacturerName} }; return new DBAccessController().RetriveRecordsWithPara(StoredProcedures.sp_GetManufacturer, DataDic); } catch { throw; } }
protected void btnSave_ServerClick(object sender, EventArgs e) { try { var ml = new Manufacturer_ML() { ManufacturerName = txtName.Text }; var result = new Manufacturer_BL().AddManufacturer(ml); if (result) { GetManufacturers(); } } catch (Exception) { throw; } }
private void GetManufacturers() { try { var ml = new Manufacturer_ML(); { ml.ManufacturerName = string.IsNullOrEmpty(txtNameSearch.Text) ? "" : txtNameSearch.Text; }; gridManufacturers.DataSource = new Manufacturer_BL().GetManufacturers(ml); gridManufacturers.DataBind(); } catch (Exception) { throw; } }
public bool DeleteManufacturer(Manufacturer_ML ml) { try { try { var DataDic = new Dictionary<string, object> { {"@Id", ml.ManufacturerId} }; return new DBAccessController().DeleteRecord(StoredProcedures.sp_RemoveManufacturer, DataDic); } catch (System.Exception) { throw; } } catch (Exception) { throw; } }
/* public DataTable GetManufacturers(Manufacturer_ML ml) { DataTable dt = new DataTable(); try { con = new SqlConnection(connectionString); con.Open(); cmd = new SqlCommand("[sp_Getmanufacturers]", con) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.AddWithValue("@VehicleType", ml.VehicleType); adp = new SqlDataAdapter(cmd); adp.Fill(dt); return dt; } catch (SqlException ex) { return dt; } finally { con.Close(); con.Dispose(); } }*/ public DataTable GetVehicleList(Manufacturer_ML ml) { DataTable dt = new DataTable(); try { con = new SqlConnection(connectionString); con.Open(); cmd = new SqlCommand("[sp_GetVehicles]", con) { CommandType = CommandType.StoredProcedure }; adp = new SqlDataAdapter(cmd); adp.Fill(dt); return dt; } catch (SqlException ex) { return dt; } finally { con.Close(); con.Dispose(); } }
public bool AddManufacturer(Manufacturer_ML ml) { try { try { var DataDic = new Dictionary<string, object> { {"@ManufactureName", ml.ManufacturerName} }; return new DBAccessController().InsertRecord(StoredProcedures.sp_AddManufacturer, DataDic); } catch (System.Exception) { throw; } } catch (Exception) { throw; } }
protected void btnUpdate_ServerClick(object sender, EventArgs e) { try { var ml = new Manufacturer_ML(gridManufacturers.GetSelectedFieldValues("ManufactureId")[0].ToString(), txtName.Text); var result = new Manufacturer_BL().UpdateManufacturer(ml); if (result) { GetManufacturers(); } } catch (Exception) { throw; } }
protected void btnDelete_ServerClick(object sender, EventArgs e) { try { if (gridManufacturers.Selection.Count > 0) { var id = (Int32)gridManufacturers.GetSelectedFieldValues("ManufactureId")[0]; var ml = new Manufacturer_ML() { ManufacturerId = id }; new Manufacturer_BL().DeleteManufacturer(ml); GetManufacturers(); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "script", "<script type='text/javascript'>$( document ).ready(function() { $('#SelectErrorModal').modal('show')});</script>", false); } } catch { throw; } }