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)
            {
                Lojtari person = new Lojtari();
                person.Emri             = txtEmri.Text.Trim();
                person.Mbiemri          = txtMbiemri.Text.Trim();
                person.EmriIPerdoruesit = txtEmriPerdoruesit.Text.Trim();
                person.Fjalkalimi       = txtFjalekalimi.Text.Trim();
                person.NumriFanelles    = int.Parse(txtNumriIfanelles.Text.Trim());
                person.Gjinia           = txtGjinia.Text.Trim();
                person.Ditelindja       = DateTime.Parse(txtDitelindja.Text.Trim());
                person.Vendlindja       = txtVendlindja.Text.Trim();
                person.GrupiGjakut      = txtGrupigjakut.Text.Trim();
                person.Shteti           = txtShtetesia.Text.Trim();
                person.Vendbanimi       = txtVendbanimi.Text.Trim();
                person.Telefoni         = txtNumriTelefonit.Text.Trim();
                person.Mail             = txtEmail.Text.Trim();
                person.Pesha            = decimal.Parse(txtPesha.Text.Trim());
                person.Gjatesia         = decimal.Parse(txtGjatesia.Text.Trim());
                person.LojtariID        = int.Parse(txtShkruajID.Text.Trim());
                LojtariBLL lojtariEditoBll = new LojtariBLL();
                lojtariEditoBll.Edito(person);

                txtEmri.Text           = txtMbiemri.Text = txtEmriPerdoruesit.Text = txtFjalekalimi.Text = txtNumriIfanelles.Text = txtGjinia.Text = txtDitelindja.Text = txtVendlindja.Text = txtGrupigjakut.Text = txtShtetesia.Text =
                    txtVendbanimi.Text = txtNumriTelefonit.Text = txtEmail.Text = txtPesha.Text = txtGjatesia.Text = "";
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtEmri.Text == "" || txtMbiemri.Text == "" || txtEmriPerdoruesit.Text == "" || txtFjalekalimi.Text == "" || txtNumriIfanelles.Text == "" ||
                txtGjinia.Text == "" || txtDitelindja.Text == "" || txtVendlindja.Text == "" || txtGrupigjakut.Text == "" ||
                txtShtetesia.Text == "" || txtVendbanimi.Text == "" || txtShtetesia.Text == "" ||
                txtEmail.Text == "" || txtPesha.Text == "" || txtGjatesia.Text == "")
            {
                MessageBox.Show("Plotesoni te gjitha fushat");
            }
            else
            {
                Lojtari person = new Lojtari();
                person.Emri             = txtEmri.Text.Trim();
                person.Mbiemri          = txtMbiemri.Text.Trim();
                person.EmriIPerdoruesit = txtEmriPerdoruesit.Text.Trim();
                person.Fjalkalimi       = txtFjalekalimi.Text.Trim();
                person.NumriFanelles    = int.Parse(txtNumriIfanelles.Text.Trim());
                person.Gjinia           = txtGjinia.Text.Trim();
                person.Ditelindja       = DateTime.Parse(txtDitelindja.Text.Trim());
                person.Vendlindja       = txtVendlindja.Text.Trim();
                person.GrupiGjakut      = txtGrupigjakut.Text.Trim();
                person.Shteti           = txtShtetesia.Text.Trim();
                person.Vendbanimi       = txtVendbanimi.Text.Trim();
                person.Telefoni         = txtNumriTelefonit.Text.Trim();
                person.Mail             = txtEmail.Text.Trim();
                person.Pesha            = decimal.Parse(txtPesha.Text.Trim());
                person.Gjatesia         = decimal.Parse(txtGjatesia.Text.Trim());
                LojtariBLL lojtariBLL = new LojtariBLL();
                lojtariBLL.Regjistro(person);

                txtEmri.Text           = txtMbiemri.Text = txtEmriPerdoruesit.Text = txtFjalekalimi.Text = txtNumriIfanelles.Text = txtGjinia.Text = txtDitelindja.Text = txtVendlindja.Text = txtGrupigjakut.Text = txtShtetesia.Text =
                    txtVendbanimi.Text = txtNumriTelefonit.Text = txtEmail.Text = txtPesha.Text = txtGjatesia.Text = "";
                MessageBox.Show("U regjistrua me sukses");
            }
        }
        public void GjejLojtarinMeID(Lojtari lojtari)
        {
            SqlConnection  sqlcon         = new SqlConnection(_connectionString);
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter("usp_GjejLojtarMeID", sqlcon);

            sqlDataAdapter.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;
            sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@LojtariID", lojtari.LojtariID);
            DataTable dtbl = new DataTable();

            sqlDataAdapter.Fill(dtbl);
            sqlDataAdapter.Dispose();
            sqlcon.Close();
            lojtari.Emri             = dtbl.Rows[0]["Emri"].ToString();
            lojtari.Mbiemri          = dtbl.Rows[0]["Mbiemri"].ToString();
            lojtari.EmriIPerdoruesit = dtbl.Rows[0]["EmriIPerdoruesit"].ToString();
            lojtari.Fjalkalimi       = dtbl.Rows[0]["Fjalekalimi"].ToString();
            lojtari.NumriFanelles    = int.Parse(dtbl.Rows[0]["NumriFanelles"].ToString());
            lojtari.Gjinia           = dtbl.Rows[0]["Gjinia"].ToString();
            lojtari.Ditelindja       = DateTime.Parse(dtbl.Rows[0]["Ditelindja"].ToString());
            lojtari.Vendlindja       = dtbl.Rows[0]["Vendlindja"].ToString();
            lojtari.GrupiGjakut      = dtbl.Rows[0]["GrupiIGjakut"].ToString();
            lojtari.Shteti           = dtbl.Rows[0]["Shteti"].ToString();
            lojtari.Vendbanimi       = dtbl.Rows[0]["Vendbanimi"].ToString();
            lojtari.Telefoni         = dtbl.Rows[0]["Telefoni"].ToString();
            lojtari.Mail             = dtbl.Rows[0]["Email"].ToString();
            lojtari.Pesha            = decimal.Parse(dtbl.Rows[0]["Pesha"].ToString());
            lojtari.Gjatesia         = decimal.Parse(dtbl.Rows[0]["Gjatesia"].ToString());
        }
        private void DtgLojtaret_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            //Nese nje rresht klikohet 2 here aktivizojme kete metode
            try
            {
                Lojtari l = new Lojtari();

                l.Emri      = DtgLojtaret.SelectedRows[0].Cells["Emri"].Value.ToString();
                l.Mbiemri   = DtgLojtaret.SelectedRows[0].Cells["Mbiemri"].Value.ToString();
                l.Shtetesia = DtgLojtaret.SelectedRows[0].Cells["Shtetesia"].Value.ToString();
                l.Pozicioni = (Pozicionet)DtgLojtaret.SelectedRows[0].Cells["Pozicioni"].Value;
                l.Ekipi     = DtgLojtaret.SelectedRows[0].Cells["Ekipi"].Value.ToString();
                l.L_ID      = int.Parse(DtgLojtaret.SelectedRows[0].Cells["L_ID"].Value.ToString());
                l.Mosha     = int.Parse(DtgLojtaret.SelectedRows[0].Cells["Mosha"].Value.ToString());
                l.Numri     = int.Parse(DtgLojtaret.SelectedRows[0].Cells["Numri"].Value.ToString());
                l.Golat     = int.Parse(DtgLojtaret.SelectedRows[0].Cells["Golat"].Value.ToString());
                l.Asistimet = int.Parse(DtgLojtaret.SelectedRows[0].Cells["Asistimet"].Value.ToString());

                EditoLojtar edL = new EditoLojtar();
                this.Hide();
                edL.FormClosed += Form_Closing_Handler;
                edL.Show();

                edL.VendosNeTxtB(l);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        private void DtgLojtaret_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //Ne kete metode marrim lojtarin nga DataGrid dhe permes Try
            //tentojme ti kapim keto informata qe na duhen ne rastin e editimit te lojtareve.

            //Gjithashtu ne Catch shfaqim mesazhin e Errorit qe duhet klikuar ne fillim
            //te rreshtit sepse eshte e mundshme qe DataGridit ti editohet shkrimi ne klikim te qelise.
            Lojtari l = new Lojtari();

            try
            {
                l.Emri      = DtgLojtaret.SelectedRows[0].Cells["Emri"].Value.ToString();
                l.Mbiemri   = DtgLojtaret.SelectedRows[0].Cells["Mbiemri"].Value.ToString();
                l.Shtetesia = DtgLojtaret.SelectedRows[0].Cells["Shtetesia"].Value.ToString();
                l.Pozicioni = (Pozicionet)DtgLojtaret.SelectedRows[0].Cells["Pozicioni"].Value;
                l.Ekipi     = DtgLojtaret.SelectedRows[0].Cells["Ekipi"].Value.ToString();
                l.L_ID      = int.Parse(DtgLojtaret.SelectedRows[0].Cells["L_ID"].Value.ToString());
                l.Mosha     = int.Parse(DtgLojtaret.SelectedRows[0].Cells["Mosha"].Value.ToString());
                l.Numri     = int.Parse(DtgLojtaret.SelectedRows[0].Cells["Numri"].Value.ToString());
                l.Golat     = int.Parse(DtgLojtaret.SelectedRows[0].Cells["Golat"].Value.ToString());
                l.Asistimet = int.Parse(DtgLojtaret.SelectedRows[0].Cells["Asistimet"].Value.ToString());
            }
            catch
            {
                MessageBox.Show("Ju lutem klikoni ne fillim te rreshtit", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            GetLojtari = l;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Lojtari lojtar = new Lojtari();

            lojtar.LojtariID = int.Parse(txtShkruajID.Text.Trim());
            LojtariBLL gjejLojtarin = new LojtariBLL();

            gjejLojtarin.GjejLojtarMeID(lojtar);
            txtEmri.Text            = lojtar.Emri.ToString();
            txtMbiemri.Text         = lojtar.Mbiemri.ToString();
            txtEmriPerdoruesit.Text = lojtar.EmriIPerdoruesit.ToString();
            txtFjalekalimi.Text     = lojtar.Fjalkalimi.ToString();
            txtNumriIfanelles.Text  = lojtar.NumriFanelles.ToString();
            txtGjinia.Text          = lojtar.Gjinia.ToString();
            txtDitelindja.Text      = lojtar.Ditelindja.ToString();
            txtVendlindja.Text      = lojtar.Vendlindja.ToString();
            txtGrupigjakut.Text     = lojtar.GrupiGjakut.ToString();
            txtShtetesia.Text       = lojtar.Shteti.ToString();
            txtVendbanimi.Text      = lojtar.Vendbanimi.ToString();
            txtNumriTelefonit.Text  = lojtar.Telefoni.ToString();
            txtEmail.Text           = lojtar.Mail.ToString();
            txtPesha.Text           = lojtar.Pesha.ToString();
            txtGjatesia.Text        = lojtar.Gjatesia.ToString();
            panel2.Visible          = true;
        }
Ejemplo n.º 7
0
        //Metoda per fshirjen e lojtarit
        public static void FshiLojtar(int id)
        {
            Lojtari lojtar = listLojtari.Where(item => item.L_ID.ToString() == id.ToString()).FirstOrDefault();

            if (lojtar.L_ID == id)
            {
                listLojtari.Remove(lojtar);
            }
        }
Ejemplo n.º 8
0
        private void BtnRuajLojtar_Click(object sender, EventArgs e)
        {
            Lojtari lojtari = new Lojtari(txtEmri.Text, txtMbiemri.Text, txtShtetesia.Text, txtAdresa.Text, (Pozicionet)CmbPozicioni.SelectedItem, CmbEkipi.Text,
                                          int.Parse(txtMosha.Text), int.Parse(txtNrK.Text), int.Parse(txtRroga.Text), int.Parse(txtNumri.Text), int.Parse(txtGolat.Text), int.Parse(txtAsistimet.Text));

            RepositoryLojtar.RegjistroLojtar(lojtari);

            MessageBox.Show("Lojtari u regjistrua me sukses");
        }
 public void Edito(Lojtari l)
 {
     try
     {
         LojtariDAL dal = new LojtariDAL();
         dal.Update(l);
     }
     catch (Exception)
     {
         throw;
     }
 }
 public void Regjistro(Lojtari l)
 {
     try
     {
         LojtariDAL lojtariDAL = new LojtariDAL();
         lojtariDAL.Shto(l);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public int GjejLojtarMeID(Lojtari l)
 {
     try
     {
         LojtariDAL gjejlojtarin = new LojtariDAL();
         gjejlojtarin.GjejLojtarinMeID(l);
         int rowsAffected = l.LojtariID;
         return(rowsAffected);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public int Fshij(Lojtari l)
 {
     try
     {
         LojtariDAL dal = new LojtariDAL();
         dal.Fshij(l);
         int rowsAffected = l.LojtariID;
         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 fshij", "Kujdes", MessageBoxButtons.YesNo);

            if (rez == DialogResult.Yes)
            {
                Lojtari lojtari = new Lojtari();
                lojtari.LojtariID = int.Parse(txtShkruajID.Text.Trim());
                LojtariBLL lojtariBLL = new LojtariBLL();
                lojtariBLL.Fshij(lojtari);

                txtShkruajID.Text = "";
            }
        }
 public void VendosNeTxtB(Lojtari l)
 {
     //Metoda VendosNeTxtB merr lojtarin e selektuar nga DataGridi dhe e vendos
     //ne formen e Editimit te lojtareve
     txtLID.Text                = l.L_ID.ToString();
     lblObjLojtari.Text         = l.Emri + " " + l.Mbiemri;
     txtEmri.Text               = l.Emri;
     txtMbiemri.Text            = l.Mbiemri;
     txtShtetesia.Text          = l.Shtetesia;
     CmbPozicioni.SelectedIndex = (int)l.Pozicioni;
     txtEkipi.Text              = l.Ekipi;
     txtMosha.Text              = l.Mosha.ToString();
     txtNumri.Text              = l.Numri.ToString();
     txtGolat.Text              = l.Golat.ToString();
     txtAsistimet.Text          = l.Asistimet.ToString();
 }
        public void Shto(Lojtari lojtari)
        {
            try
            {
                SqlConnection sqlcon = new SqlConnection(_connectionString);
                sqlcon.Open();
                SqlCommand command = new SqlCommand();
                command.CommandText = "usp_Lojtare_ShtoLojtare";
                command.CommandType = CommandType.StoredProcedure;
                command.Connection  = sqlcon;

                command.Parameters.AddWithValue("@Emri", lojtari.Emri);
                command.Parameters.AddWithValue("@Mbiemri", lojtari.Mbiemri);
                command.Parameters.AddWithValue("@EmriIPerdoruesit", lojtari.EmriIPerdoruesit);
                command.Parameters.AddWithValue("@Fjalkalimi", lojtari.Fjalkalimi);
                command.Parameters.AddWithValue("@NumriIFanelles", lojtari.NumriFanelles);
                command.Parameters.AddWithValue("@Gjinia", lojtari.Gjinia);
                command.Parameters.AddWithValue("@Ditelindja", lojtari.Ditelindja);
                command.Parameters.AddWithValue("@Vendlindja", lojtari.Vendlindja);
                command.Parameters.AddWithValue("@GrupiIGjakut", lojtari.GrupiGjakut);
                command.Parameters.AddWithValue("@Shteti", lojtari.Shteti);
                command.Parameters.AddWithValue("@Vendbanimi", lojtari.Vendbanimi);
                command.Parameters.AddWithValue("@Telefoni", lojtari.Telefoni);
                command.Parameters.AddWithValue("@Mail", lojtari.Mail);
                command.Parameters.AddWithValue("@Pesha", lojtari.Pesha);
                command.Parameters.AddWithValue("@Gjatesia", lojtari.Gjatesia);
                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("@PersoneliID", 0);
                command.Parameters.AddWithValue("@klubiID", 1);

                command.ExecuteNonQuery();
                command.Dispose();
                sqlcon.Close();
                sqlcon.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 16
0
        //Metoda per editimin e lojtareve
        public static void EditoLojtar(int id, string emri, string mbiemri, int mosha, Pozicionet pozicioni,
                                       string shtetesia, string ekipi, int golat, int asistimet, int numri)
        {
            //Variabli teDhenat merr informacionin mbi lojtarin qe po editohet dhe lidhet me ID-ne
            //e tij, qe ti referohemi objektit te duhur qe eshte selektuar pasi ID eshte unike
            Lojtari teDhenat = listLojtari.Where(item => item.L_ID.ToString() == id.ToString()).FirstOrDefault();

            if (teDhenat.L_ID == id)
            {
                teDhenat.Emri      = emri;
                teDhenat.Mbiemri   = mbiemri;
                teDhenat.Shtetesia = shtetesia;
                teDhenat.Pozicioni = pozicioni;
                teDhenat.Ekipi     = ekipi;
                teDhenat.Mosha     = mosha;
                teDhenat.Numri     = numri;
                teDhenat.Golat     = golat;
                teDhenat.Asistimet = asistimet;
            }
        }
        //  public string _connectionString = ConfigurationManager.ConnectionStrings["Gjeneta"].ConnectionString;

        public int Fshij(Lojtari model)
        {
            try
            {
                SqlConnection sqlcon = new SqlConnection(_connectionString);
                sqlcon.Open();
                SqlCommand command = new SqlCommand("usp_FshijLojtarMeID", sqlcon);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@LojtariID", model.LojtariID);
                int result = command.ExecuteNonQuery();
                command.Dispose();
                sqlcon.Close();
                sqlcon.Dispose();
                return(result);
            }
            catch (Exception e)
            {
                return(-1);
            }
        }
        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             der2            = comboBox1.SelectedValue.ToString();
                StatusiLojtarit statusiLojtarit = new StatusiLojtarit();
                statusiLojtarit.Pergjegjes = txtPergjegjes.Text.Trim();
                statusiLojtarit.Rezerv     = txtRezerve.Text.Trim();
                statusiLojtarit.Huazim     = txtHuazim.Text.Trim();
                statusiLojtarit.Shoqerues  = txtShoqerues.Text.Trim();
                statusiLojtarit.StatusiID  = int.Parse(txtGjejMeIDFormacion.Text.Trim());
                Lojtari lojtari = new Lojtari();
                lojtari.LojtariID = int.Parse(der2);
                StatusiLojtaritBLL statusiLojtaritDAL = new StatusiLojtaritBLL();
                statusiLojtaritDAL.Edito(statusiLojtarit);

                txtPergjegjes.Text = txtHuazim.Text = txtShoqerues.Text = comboBox1.Text = "";
            }
        }
Ejemplo n.º 19
0
 //Metoda per regjistrimin e lojtareve
 public static void RegjistroLojtar(Lojtari l)
 {
     listLojtari.Add(l);
 }