public int Update(Ndeshja ndeshjaModel) { try { SqlConnection sqlcon = new SqlConnection(_connectionString); sqlcon.Open(); SqlCommand command = new SqlCommand("[dbo].[usp_ShtooseEdito_Ndeshje]", sqlcon); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@NdeshjaID", ndeshjaModel.NdeshjaID); command.Parameters.AddWithValue("@DataENdeshjes", ndeshjaModel.dataNdeshjes); command.Parameters.AddWithValue("@Sezoni", ndeshjaModel.Sezoni); command.Parameters.AddWithValue("@RaportiIAmbulances", ndeshjaModel.RaportiAmbulances); command.Parameters.AddWithValue("@RaportiIPolicis", ndeshjaModel.RaportiPolicor); command.Parameters.AddWithValue("@InsertBy", 1); command.Parameters.AddWithValue("@InsertDate", "06/05/2020"); command.Parameters.AddWithValue("@LUB", 1); command.Parameters.AddWithValue("@LUD", "06/05/2020"); command.Parameters.AddWithValue("@LUN", 1); command.Parameters.AddWithValue("@KlubiVendasID", 1); command.Parameters.AddWithValue("@KlubiNikoqirID", 2); command.Parameters.AddWithValue("@FormacioniID", 1); command.Parameters.AddWithValue("@StadiumiID", 2); int rowAffected = command.ExecuteNonQuery(); command.Dispose(); sqlcon.Close(); sqlcon.Dispose(); return(rowAffected); } catch (Exception e) { return(-1); } }
public void Regjistro(Ndeshja g) { try { NdeshjaDAL dal = new NdeshjaDAL(); dal.Shto(g); } catch (Exception ex) { throw ex; } }
public void Edito(Ndeshja g) { try { NdeshjaDAL dal = new NdeshjaDAL(); dal.Update(g); } catch (Exception) { throw; } }
private void button2_Click(object sender, EventArgs e) { Ndeshja ndeshja = new Ndeshja(); ndeshja.NdeshjaID = int.Parse(txtShkruajID.Text.Trim()); NdeshjaBLL dali = new NdeshjaBLL(); dali.GjejNdeshjenMeID(ndeshja); dtData.Text = ndeshja.dataNdeshjes.ToString(); txtSezoni.Text = ndeshja.Sezoni; txtRaportiAmbulances.Text = ndeshja.RaportiAmbulances; txtRaportiPolicis.Text = ndeshja.RaportiPolicor; panel2.Visible = true; }
public int GjejNdeshjenMeID(Ndeshja g) { try { NdeshjaDAL dal = new NdeshjaDAL(); dal.MerrNdeshjeMeID(g); int rowsAffected = g.NdeshjaID; return(rowsAffected); } catch (Exception ex) { throw ex; } }
public int Fshij(Ndeshja g) { try { NdeshjaDAL dal = new NdeshjaDAL(); dal.Fshij(g); int rowsAffected = g.NdeshjaID; return(rowsAffected); } catch (Exception ex) { throw ex; } }
private void button1_Click(object sender, EventArgs e) { var rez = MessageBox.Show("A jeni te sigurt qe deshironi te editoni", "Kujdes", MessageBoxButtons.YesNo); if (rez == DialogResult.Yes) { Ndeshja ndeshja = new Ndeshja(); ndeshja.dataNdeshjes = DateTime.Parse(dtData.Text.Trim()); ndeshja.Sezoni = txtSezoni.Text.Trim(); ndeshja.RaportiAmbulances = txtRaportiAmbulances.Text.Trim(); ndeshja.RaportiPolicor = txtRaportiPolicis.Text.Trim(); ndeshja.NdeshjaID = int.Parse(txtShkruajID.Text); NdeshjaBLL ndeshjaDAL = new NdeshjaBLL(); ndeshjaDAL.Edito(ndeshja); dtData.Text = txtSezoni.Text = txtRaportiAmbulances.Text = txtRaportiPolicis.Text = ""; } }
private void button1_Click(object sender, EventArgs e) { if (txtSezoni.Text == " " || txtRaportiAmbulances.Text == "" || txtRaportiPolicis.Text == "") { MessageBox.Show("Plotesoni te gjitha fushat"); } else { Ndeshja ndeshja = new Ndeshja(); ndeshja.dataNdeshjes = DateTime.Parse(dtData.Text.Trim()); ndeshja.Sezoni = txtSezoni.Text.Trim(); ndeshja.RaportiAmbulances = txtRaportiAmbulances.Text.Trim(); ndeshja.RaportiPolicor = txtRaportiPolicis.Text.Trim(); NdeshjaBLL ndeshjaDAL = new NdeshjaBLL(); ndeshjaDAL.Regjistro(ndeshja); dtData.Text = txtSezoni.Text = txtRaportiAmbulances.Text = txtRaportiPolicis.Text = ""; MessageBox.Show("U regjistrua me sukses"); } }
// public string _connectionString = ConfigurationManager.ConnectionStrings["Gjeneta"].ConnectionString; public int Fshij(Ndeshja model) { try { SqlConnection sqlcon = new SqlConnection(_connectionString); sqlcon.Open(); SqlCommand command = new SqlCommand("usp_FshijMeId_Ndeshje", sqlcon); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@NdeshjaID", model.NdeshjaID); int result = command.ExecuteNonQuery(); command.Dispose(); sqlcon.Close(); sqlcon.Dispose(); return(result); } catch (Exception e) { return(-1); } }
public void MerrNdeshjeMeID(Ndeshja ndeshja) { try { SqlConnection sqlcon = new SqlConnection(_connectionString); sqlcon.Open(); SqlDataAdapter sqlda = new SqlDataAdapter("usp_MerrNdeshjenMeID", sqlcon); sqlda.SelectCommand.CommandType = CommandType.StoredProcedure; sqlda.SelectCommand.Parameters.AddWithValue("@NdeshjaID", ndeshja.NdeshjaID); DataTable dt = new DataTable(); sqlda.Fill(dt); sqlda.Dispose(); sqlcon.Close(); ndeshja.dataNdeshjes = DateTime.Parse(dt.Rows[0]["DataENdeshjes"].ToString()); ndeshja.Sezoni = dt.Rows[0]["Sezoni"].ToString(); ndeshja.RaportiAmbulances = dt.Rows[0]["RaportiIAmbulances"].ToString(); ndeshja.RaportiPolicor = dt.Rows[0]["RaportiIPolicise"].ToString(); } catch (Exception ex) { throw ex; } }