public string GetTowTruckInfo(TowTruckService_ML ml) { DataTable dt = new DataTable(); try { con = new SqlConnection(connectionString); con.Open(); cmd = new SqlCommand("sp_GetTowTruckServices", con) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.AddWithValue("@Location", ml.location); adp = new SqlDataAdapter(cmd); adp.Fill(dt); string json = JsonConvert.SerializeObject(dt, Formatting.Indented); return json; } catch (SqlException ex) { return "Fail"; } finally { con.Close(); con.Dispose(); } }
public string GetTowTruckServiceInfo(TowTruckService_ML ml) { try { return new TowTruckService_DL().GetTowTruckInfo(ml); } catch { throw; } }
public bool DeleteTowTruckService(TowTruckService_ML ml) { try { var DataDic = new Dictionary<string, object> { {"@Id", ml.id} }; return new DBAccessController().DeleteRecord(StoredProcedures.sp_RemoveTowTruckService, DataDic); } catch (System.Exception) { throw; } }
public DataTable GetTowTruckServices(TowTruckService_ML ml) { try { var DataDic = new Dictionary<string, object> { {"@Location",ml.location} }; return new DBAccessController().RetriveRecordsWithPara(StoredProcedures.sp_GetTowTruckServices, DataDic); } catch (System.Exception) { throw; } }
private void GetTowTruckServices() { try { var ml = new TowTruckService_ML() { location=string.IsNullOrEmpty(txtLocationSearch.Text) ? "" : txtLocationSearch.Text }; gridTowTrucks.DataSource = new TowTruckService_BL().GetTowTruckServices(ml); gridTowTrucks.DataBind(); } catch (Exception) { throw; } }
public bool UpdateTowTruckService(TowTruckService_ML ml) { try { var DataDic = new Dictionary<string, object> { {"@Id", ml.id}, {"@TTSName", ml.name}, {"@TTSLocation",ml.location}, {"@TTSTP",ml.tp}, {"@TTSEmail",ml.email} }; return new DBAccessController().UpdateRecord(StoredProcedures.sp_UpdateTowTruckService, DataDic); } catch (System.Exception) { throw; } }
protected void btnSave_ServerClick(object sender, EventArgs e) { try { var ml = new TowTruckService_ML() { name = txtName.Text, tp = txtTp.Value, location = txtLocation.Value, email = txtEmail.Value }; var result = new TowTruckService_BL().AddTowTruckService(ml); if (result) { GetTowTruckServices(); } } catch (Exception) { throw; } }
protected void btnDelete_ServerClick(object sender, EventArgs e) { try { if (gridTowTrucks.Selection.Count > 0) { var id = (Int32)gridTowTrucks.GetSelectedFieldValues("Id")[0]; var ml = new TowTruckService_ML() { id = id }; new TowTruckService_BL().DeleteTowTruckService(ml); GetTowTruckServices(); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "script", "<script type='text/javascript'>$( document ).ready(function() { $('#SelectErrorModal').modal('show')});</script>", false); } } catch (Exception) { throw; } }
protected void btnUpdate_ServerClick(object sender, EventArgs e) { try { var ml = new TowTruckService_ML(gridTowTrucks.GetSelectedFieldValues("Id")[0].ToString(),txtName.Text,txtLocation.Value,txtTp.Value,txtEmail.Value); var result = new TowTruckService_BL().UpdateTowTruckService(ml); if (result) { GetTowTruckServices(); } } catch (Exception) { throw; } }