Exemple #1
0
 public int Update(Golashenuesit golaShenuesi)//,Lojtari lojtari, Ndeshja ndeshja)
 {
     try
     {
         SqlConnection sqlcon = new SqlConnection(_connectionString);
         sqlcon.Open();
         SqlCommand command = new SqlCommand("usp_Golashenuesi_ShtooseEdito", sqlcon);
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.AddWithValue("@GolashenuesiID", golaShenuesi.GolashenuesiID);
         command.Parameters.AddWithValue("@LojtariID", golaShenuesi.lojtariID);
         command.Parameters.AddWithValue("@Golat", golaShenuesi.NumriGolave);
         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("@NdeshjaID", 1);
         int rowAffected = command.ExecuteNonQuery();
         command.Dispose();
         sqlcon.Close();
         sqlcon.Dispose();
         return(rowAffected);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
 public List <Golashenuesit> GetAllByList()
 {
     try
     {
         List <Golashenuesit> rezult = null;
         SqlConnection        sqlcon = new SqlConnection(_connectionString);
         sqlcon.Open();
         SqlCommand command = new SqlCommand("usp_Golashenuesi_MerrTeGjithListen", sqlcon);
         command.CommandType = CommandType.StoredProcedure;
         SqlDataReader reader = command.ExecuteReader();
         rezult = new List <Golashenuesit>();
         while (reader.Read())
         {
             Golashenuesit gr = new Golashenuesit();
             gr.lojtariID   = int.Parse(reader["LojtariId"].ToString());
             gr.NumriGolave = int.Parse(reader["Golat"].ToString());
             rezult.Add(gr);
             Golashenuesit.obj.Add(gr);
         }
         return(rezult);
     }
     catch (Exception e)
     {
         return(null);
     }
 }
 public void Regjistro(Golashenuesit g)
 {
     try
     {
         GolashenuesiDAL dal = new GolashenuesiDAL();
         dal.Shto(g);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void Edito(Golashenuesit g)
 {
     try
     {
         GolashenuesiDAL dal = new GolashenuesiDAL();
         dal.Update(g);
     }
     catch (Exception)
     {
         throw;
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            var rez = MessageBox.Show("A jeni te sigurt qe deshironi te fshij", "Kujdes", MessageBoxButtons.YesNo);

            if (rez == DialogResult.Yes)
            {
                Golashenuesit golaShenuesi = new Golashenuesit();
                golaShenuesi.GolashenuesiID = int.Parse(txtKerkoMeID.Text.Trim());
                GolashenuesiBLL golaShenuesiBLLL = new GolashenuesiBLL();
                golaShenuesiBLLL.Fshij(golaShenuesi);
                txtKerkoMeID.Text = "";
            }
        }
Exemple #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            Golashenuesit golashenuesit = new Golashenuesit();

            golashenuesit.GolashenuesiID = int.Parse(txtKerkoMeID.Text.Trim());
            GolashenuesiBLL gjejGolaShenuesin = new GolashenuesiBLL();

            gjejGolaShenuesin.GjejGolashenuesinmeID(golashenuesit);
            cmbLojtari.Text      = golashenuesit.lojtariID.ToString();
            txtEmriLojtarit.Text = golashenuesit.EmriLojtarit.ToString();
            txtNumriGolave.Text  = golashenuesit.NumriGolave.ToString();
            cmbNdeshja.Text      = golashenuesit.ndeshjaID.ToString();
            panel2.Visible       = true;
        }
 public int GjejGolashenuesinmeID(Golashenuesit g)
 {
     try
     {
         GolashenuesiDAL dal = new GolashenuesiDAL();
         dal.MerrGolashenuesinMeID(g);
         int rowsAffected = g.lojtariID;
         return(rowsAffected);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public int Fshij(Golashenuesit g)
 {
     try
     {
         GolashenuesiDAL dal = new GolashenuesiDAL();
         dal.Fshij(g);
         int rowsAffected = g.GolashenuesiID;
         return(rowsAffected);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #9
0
        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)
            {
                var           lojtari       = cmbLojtari.SelectedValue.ToString();
                var           ndeshja       = cmbNdeshja.SelectedValue.ToString();
                Golashenuesit golaShenuesit = new Golashenuesit();
                golaShenuesit.GolashenuesiID = int.Parse(txtKerkoMeID.Text);
                golaShenuesit.EmriLojtarit   = txtEmriLojtarit.Text.Trim();
                golaShenuesit.lojtariID      = int.Parse(lojtari);
                golaShenuesit.NumriGolave    = int.Parse(txtNumriGolave.Text.Trim());
                golaShenuesit.ndeshjaID      = int.Parse(ndeshja);
                GolashenuesiBLL golashenuesiBLL = new GolashenuesiBLL();
                golashenuesiBLL.Edito(golaShenuesit);
                cmbLojtari.Text = cmbNdeshja.Text = txtNumriGolave.Text = "";
            }
        }
Exemple #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txtNumriGolave.Text == " ")
     {
         MessageBox.Show("Plotesoni te gjitha fushat");
     }
     else
     {
         var           lojtari       = cmbLojtari.SelectedValue.ToString();
         var           ndeshja       = cmbNdeshja.SelectedValue.ToString();
         Golashenuesit golaShenuesit = new Golashenuesit();
         golaShenuesit.lojtariID   = int.Parse(lojtari);
         golaShenuesit.NumriGolave = int.Parse(txtNumriGolave.Text.Trim());
         golaShenuesit.ndeshjaID   = int.Parse(ndeshja);
         GolashenuesiBLL golashenuesiBLL = new GolashenuesiBLL();
         golashenuesiBLL.Regjistro(golaShenuesit);
         cmbLojtari.Text = cmbNdeshja.Text = txtNumriGolave.Text = "";
         MessageBox.Show("U regjistrua me sukses");
     }
 }
Exemple #11
0
 public int Fshij(Golashenuesit golaShenuesi)
 {
     try
     {
         SqlConnection sqlcon = new SqlConnection(_connectionString);
         sqlcon.Open();
         SqlCommand command = new SqlCommand("usp_Golashenuesi_FshijGolashenuesin", sqlcon);
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.AddWithValue("@GolashenuesiID", golaShenuesi.GolashenuesiID);
         int result = command.ExecuteNonQuery();
         command.Dispose();
         sqlcon.Close();
         sqlcon.Dispose();
         return(result);
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
Exemple #12
0
        public void MerrGolashenuesinMeID(Golashenuesit golaShenuesi)//, Lojtari lojtari, Ndeshja ndeshja)
        {
            SqlConnection sqlcon = new SqlConnection(_connectionString);

            sqlcon.Open();
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter("usp_Golashenuesi_MerrGolashenuesMeID", sqlcon);

            sqlDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
            sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@GolashenuesiID", golaShenuesi.GolashenuesiID);

            DataTable dataTable = new DataTable();

            sqlDataAdapter.Fill(dataTable);
            sqlDataAdapter.Dispose();
            sqlcon.Close();

            golaShenuesi.GolashenuesiID = int.Parse(dataTable.Rows[0]["GolaShenuesiId"].ToString());
            golaShenuesi.lojtariID      = int.Parse(dataTable.Rows[0]["LojtariId"].ToString());
            golaShenuesi.NumriGolave    = int.Parse(dataTable.Rows[0]["Golat"].ToString());
            golaShenuesi.ndeshjaID      = int.Parse(dataTable.Rows[0]["NdeshjaId"].ToString());
        }