protected void Klasaddl_SelectedIndexChanged(object sender, EventArgs e) { Indeksiddl.SelectedIndex = 0; DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); var nxensi_klasa = from c in financa_sh.Nxenesis where (c.Klasa == Klasaddl.SelectedValue) && (c.Indeksi == Indeksiddl.SelectedValue) && (c.Viti_shkollor == vitiddl1.SelectedValue) let emri = c.Emri let mbiemri = c.Mbiemri select new { c.Id_nxenesi, c.Emri, c.Mbiemri, em = emri + " " + mbiemri, c.Atesia, c.Memesia, c.Ditelindja, c.Nr_amza, c.Nr_tel }; Nxenesiddl.DataSource = nxensi_klasa; Nxenesiddl.DataTextField = "em"; Nxenesiddl.DataValueField = "Id_nxenesi"; Nxenesiddl.DataBind(); Atesialbl.Text = ""; Memesialbl.Text = ""; Amzalbl.Text = ""; Tellbl.Text = ""; kestelbl.Text = ""; hide(); }
protected void Indeksiddl_SelectedIndexChanged(object sender, EventArgs e) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); var nxensi_klasa = from c in financa_sh.Nxenesis where (c.Klasa == Klasaddl.SelectedValue) && (c.Indeksi == Indeksiddl.SelectedValue) && (c.Viti_shkollor == vitiddl1.SelectedValue) let emri = c.Emri let mbiemri = c.Mbiemri select new { c.Id_nxenesi, c.Emri, c.Mbiemri, em = emri + " " + mbiemri, c.Atesia, c.Memesia, c.Ditelindja, c.Nr_amza, c.Nr_tel }; Nxenesiddl.DataSource = nxensi_klasa; Nxenesiddl.DataTextField = "em"; Nxenesiddl.DataValueField = "Id_nxenesi"; Nxenesiddl.DataBind(); if (Nxenesiddl.Text != "") { //vendos gjeneralitetet Atesialbl.Text = "ATESIA : " + nxensi_klasa.FirstOrDefault().Atesia.ToString(); Memesialbl.Text = "MEMESIA : " + nxensi_klasa.FirstOrDefault().Memesia.ToString(); Tellbl.Text = "TEL : " + nxensi_klasa.FirstOrDefault().Nr_tel.ToString(); Amzalbl.Text = "AMZA : " + nxensi_klasa.FirstOrDefault().Nr_amza.ToString(); //shikon nqs ka keste ose prenotim if ((ka_keste(Convert.ToInt64(Nxenesiddl.SelectedValue)) == false) || (ka_prenotim(Convert.ToInt64(Nxenesiddl.SelectedValue)) == false)) { kestelbl.Text = "Nxenesi nuk ka keste ose prenotim !"; kestelbl.ForeColor = System.Drawing.Color.Red; hide(); } else { kestelbl.Text = ""; keste_pa_pag_check(); show(); kestetotlbl.Text = "0"; valutalbl.Text = valuta(); totalilbl.Text = kestetotlbl.Text; valutalbl0.Text = valutalbl.Text; if (ka_pag_keste_tegjitha(Convert.ToInt64(Nxenesiddl.SelectedValue))) { kestelbl.Text = "Nxenesi i ka paguar te gjitha kestet !"; kestelbl.ForeColor = System.Drawing.Color.Green; hide(); } } } else { kestelbl.Text = ""; hide(); Atesialbl.Text = ""; Memesialbl.Text = ""; Amzalbl.Text = ""; Tellbl.Text = ""; } menjehere.Visible = false; }
protected void Button2_Click(object sender, EventArgs e) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); Prenotimi p = new Prenotimi(); nxenesit.Emri = Convert.ToString(Emritxt.Text); nxenesit.Mbiemri = Convert.ToString(Mbiemritxt.Text); nxenesit.Atesia = Convert.ToString(Atesiatxt.Text); nxenesit.Memesia = Convert.ToString(Memesiatxt.Text); nxenesit.Nr_amza = Convert.ToString(Amzatxt.Text); nxenesit.Nr_tel = Convert.ToString(Teltxt.Text); nxenesit.Ditelindja = Convert.ToString(Ditelindjatxt.Text); nxenesit.Viti_shkollor = Convert.ToString(vitiddl0.SelectedItem.Text); nxenesit.Klasa = Convert.ToString(DropDownList1.SelectedItem.Text); nxenesit.Indeksi = Convert.ToString(DropDownList2.SelectedItem.Text); financa_sh.Nxenesis.InsertOnSubmit(nxenesit); financa_sh.SubmitChanges(); // insert te tebela e prenotimit var nx_fundit = from t in financa_sh.Nxenesis orderby t.Id_nxenesi descending select t.Id_nxenesi; p.Id_nxenesi = nx_fundit.FirstOrDefault(); p.Paguar = false; financa_sh.Prenotimis.InsertOnSubmit(p); financa_sh.SubmitChanges(); bind(); hide_control(); }
protected void Nxenesiddl_SelectedIndexChanged(object sender, EventArgs e) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); Nxenesiddl.DataBind(); var nxenesi_id = from c in financa_sh.Nxenesis where (c.Id_nxenesi.ToString() == Nxenesiddl.SelectedValue) select new { c.Atesia, c.Memesia, c.Ditelindja, c.Nr_amza, c.Nr_tel }; if (Nxenesiddl.Text != "") { //vendos gjeneralitetet Atesialbl.Text = "ATESIA : " + nxenesi_id.FirstOrDefault().Atesia.ToString(); Memesialbl.Text = "MEMESIA : " + nxenesi_id.FirstOrDefault().Memesia.ToString(); Tellbl.Text = "TEL : " + nxenesi_id.FirstOrDefault().Nr_tel.ToString(); Amzalbl.Text = "AMZA : " + nxenesi_id.FirstOrDefault().Nr_amza.ToString(); //shikon nqs ka keste if (ka_keste(Convert.ToInt64(Nxenesiddl.SelectedValue)) == false) { kestelbl.Text = "Nxenesi nuk i jane konfiguruar kestet !"; kestelbl.ForeColor = System.Drawing.Color.Red; bind(); } else { bind(); kestelbl.Text = ""; } } }
//lidh tabelen nxenesit ne db me gridview public void bind() { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); var nxensi_klasa = from c in financa_sh.Nxenesis where (c.Klasa == DropDownList1.SelectedValue) && (c.Indeksi == DropDownList2.SelectedValue) && (c.Viti_shkollor == vitiddl0.SelectedValue) select new { c.Id_nxenesi, c.Emri, c.Mbiemri, c.Atesia, c.Memesia, c.Ditelindja, c.Nr_amza, c.Nr_tel, c.Viti_shkollor, c.Klasa, c.Indeksi, trans = (from t in financa_sh.Transportis where (c.Id_nxenesi == t.Id_nxenesi) group t by t into nr select nr.Count().Equals(0)) }; GridView1.DataSource = nxensi_klasa; GridView1.DataBind(); }
protected void Nxenesiddl_SelectedIndexChanged(object sender, EventArgs e) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); Nxenesiddl.DataBind(); var nxenesi_id = from c in financa_sh.Nxenesis where (c.Id_nxenesi.ToString() == Nxenesiddl.SelectedValue) select new { c.Atesia, c.Memesia, c.Ditelindja, c.Nr_amza, c.Nr_tel }; if (Nxenesiddl.Text != "") { //vendos gjeneralitetet Atesialbl.Text = "ATESIA : " + nxenesi_id.FirstOrDefault().Atesia.ToString(); Memesialbl.Text = "MEMESIA : " + nxenesi_id.FirstOrDefault().Memesia.ToString(); Tellbl.Text = "TEL : " + nxenesi_id.FirstOrDefault().Nr_tel.ToString(); Amzalbl.Text = "AMZA : " + nxenesi_id.FirstOrDefault().Nr_amza.ToString(); //shikon nqs ka keste if (ka_prenotim(Convert.ToInt64(Nxenesiddl.SelectedValue)) == true) { if (ka_keste(Convert.ToInt64(Nxenesiddl.SelectedValue)) == false) { //kestelbl.Text = "Nxenesi nuk i jane konfiguruar kestet !"; Button2.Visible = true; kestelbl.ForeColor = System.Drawing.Color.Red; hide(); } else { kestelbl.Text = ""; keste_pa_pag_check(); show(); kestetotlbl.Text = "0"; valutalbl.Text = valuta(); totalilbl.Text = kestetotlbl.Text; valutalbl0.Text = valutalbl.Text; if (ka_pag_keste_tegjitha(Convert.ToInt64(Nxenesiddl.SelectedValue))) { kestelbl.Text = "Nxenesi i ka paguar te gjitha kestet !"; kestelbl.ForeColor = System.Drawing.Color.Green; hide(); } } } else { kestelbl.Text = "Nxenesi nuk ka paguar prenotimin !"; } } }
protected void Indeksiddl_SelectedIndexChanged(object sender, EventArgs e) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); var nxensi_klasa = from c in financa_sh.Nxenesis where (c.Klasa == Klasaddl.SelectedValue) && (c.Indeksi == Indeksiddl.SelectedValue) && (c.Viti_shkollor == vitiddl1.SelectedValue) let emri = c.Emri let mbiemri = c.Mbiemri select new { c.Id_nxenesi, c.Emri, c.Mbiemri, em = emri + " " + mbiemri, c.Atesia, c.Memesia, c.Ditelindja, c.Nr_amza, c.Nr_tel }; Nxenesiddl.DataSource = nxensi_klasa; Nxenesiddl.DataTextField = "em"; Nxenesiddl.DataValueField = "Id_nxenesi"; Nxenesiddl.DataBind(); if (Nxenesiddl.Text != "") { //vendos gjeneralitetet Atesialbl.Text = "ATESIA : " + nxensi_klasa.FirstOrDefault().Atesia.ToString(); Memesialbl.Text = "MEMESIA : " + nxensi_klasa.FirstOrDefault().Memesia.ToString(); Tellbl.Text = "TEL : " + nxensi_klasa.FirstOrDefault().Nr_tel.ToString(); Amzalbl.Text = "AMZA : " + nxensi_klasa.FirstOrDefault().Nr_amza.ToString(); //shikon nqs ka keste if (ka_keste(Convert.ToInt64(Nxenesiddl.SelectedValue)) == false) { //kestelbl.Text = "Nxenesi nuk i jane konfiguruar kestet !"; hide(); } else { keste_pa_pag_check(); show(); if (ka_pag_keste_tegjitha(Convert.ToInt64(Nxenesiddl.SelectedValue))) { hide(); } } } else { hide(); Atesialbl.Text = ""; Memesialbl.Text = ""; Amzalbl.Text = ""; Tellbl.Text = ""; } }
protected void bind() { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Skonto sk = new Skonto(); Nxenesi nx = new Nxenesi(); var sk_nx = from c in financa_sh.Skontos from c1 in financa_sh.Nxenesis where (c1.Id_nxenesi == c.Id_nxenesi) && (c1.Klasa == Klasaddl.SelectedItem.Text) && (c1.Indeksi == Indeksiddl.SelectedItem.Text) && (c1.Viti_shkollor == vitiddl1.SelectedItem.Text) select new { c1.Id_nxenesi, c1.Emri, c1.Mbiemri, c.Ulje_1, c.Ulje_2, c.Ulje_3, c.Ulje_4, c.Ulje_5, c.Ulje_6, c.Ulje_7, c.Ulje_8, c.Ulje_9, c.Ulje_10, c.Ulje_11, c.Ulje_12 }; GridView1.DataSource = sk_nx; GridView1.DataBind(); }
protected bool ka_pagesa(long id_nx) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); Skonto sk = new Skonto(); Transporti tr = new Transporti(); bool ka_trans, ka_keste, ka_prenotim; var trans = from c in financa_sh.Transportis where (c.Id_nxenesi == id_nx) select c; if (trans.Count() == 0) { ka_trans = false; } else { ka_trans = true; } var ka_skonto = from c in financa_sh.Skontos where (c.Id_nxenesi == id_nx) select c; if (ka_skonto.Count() == 0) { ka_keste = false; } else { ka_keste = true; } var prenotim = from c in financa_sh.Prenotimis where (c.Id_nxenesi == id_nx) select c; if (prenotim.FirstOrDefault().Paguar == false) { ka_prenotim = false; } else { ka_prenotim = true; } return(ka_keste || ka_trans || ka_prenotim); }
protected void Indeksiddl_SelectedIndexChanged(object sender, EventArgs e) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); var nxensi_klasa = from c in financa_sh.Nxenesis where (c.Klasa == Klasaddl.SelectedValue) && (c.Indeksi == Indeksiddl.SelectedValue) && (c.Viti_shkollor == vitiddl1.SelectedValue) let emri = c.Emri let mbiemri = c.Mbiemri select new { c.Id_nxenesi, c.Emri, c.Mbiemri, em = emri + " " + mbiemri, c.Atesia, c.Memesia, c.Ditelindja, c.Nr_amza, c.Nr_tel }; Nxenesiddl.DataSource = nxensi_klasa; Nxenesiddl.DataTextField = "em"; Nxenesiddl.DataValueField = "Id_nxenesi"; Nxenesiddl.DataBind(); if (Nxenesiddl.Text != "") { //vendos gjeneralitetet Atesialbl.Text = "ATESIA : " + nxensi_klasa.FirstOrDefault().Atesia.ToString(); Memesialbl.Text = "MEMESIA : " + nxensi_klasa.FirstOrDefault().Memesia.ToString(); Tellbl.Text = "TEL : " + nxensi_klasa.FirstOrDefault().Nr_tel.ToString(); Amzalbl.Text = "AMZA : " + nxensi_klasa.FirstOrDefault().Nr_amza.ToString(); //shikon nqs ka keste if ((ka_keste(Convert.ToInt64(Nxenesiddl.SelectedValue)) == false) && (ka_prenotim(Convert.ToInt64(Nxenesiddl.SelectedValue)) == false)) { kestelbl.Text = "Nxenesi nuk ka pagesa !"; kestelbl.ForeColor = System.Drawing.Color.Red; } else { bind(); // Label4.Text= gjej_kestin().ToString(); //Label6.Text = (Convert.ToDecimal(Label4.Text) * Convert.ToDecimal(Label5.Text)).ToString(); } } else { kestelbl.Text = ""; Atesialbl.Text = ""; Memesialbl.Text = ""; Amzalbl.Text = ""; Tellbl.Text = ""; } }
protected void bind() { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Kestet k = new Kestet(); Nxenesi n = new Nxenesi(); var nxenesit_keste_1 = from d in financa_sh.Nxenesis from c in financa_sh.Kestets where (c.Id_nxenesi == d.Id_nxenesi) && (d.Viti_shkollor == vitiddl1.SelectedItem.Text) && (d.Klasa == Klasaddl.SelectedItem.Text) && (d.Indeksi == Indeksiddl.SelectedItem.Text) group c by new { d.Emri, d.Mbiemri, c.Vlera } into kestet_sum_1 select new { emri1 = kestet_sum_1.Key.Emri, mbiemri1 = kestet_sum_1.Key.Mbiemri, keste_pa = kestet_sum_1.Count(x => x.Paguar == true), keste_paguar = kestet_sum_1.Count(x => ((x.Paguar == false) && (x.Aktiv == true))), vlera_paguar = kestet_sum_1.Key.Vlera * kestet_sum_1.Count(x => ((x.Paguar == false) && (x.Aktiv == true))), vlera_papag = kestet_sum_1.Key.Vlera * kestet_sum_1.Count(x => x.Paguar == true) }; GridView1.DataSource = nxenesit_keste_1; GridView1.DataBind(); if (GridView1.Rows.Count > 0) { Label4.Visible = true; Label5.Visible = true; Label6.Visible = true; Label7.Visible = true; Button1.Visible = true; } else { Button1.Visible = false; Label4.Visible = false; Label5.Visible = false; Label6.Visible = false; Label7.Visible = false; } Label2.Text = Convert.ToString(kesti_kuq()); }
protected void bind() { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Skonto sk = new Skonto(); Nxenesi nx = new Nxenesi(); var sk_nx = from c in financa_sh.Skontos from c1 in financa_sh.Nxenesis from c2 in financa_sh.Kestets where (c1.Id_nxenesi == c.Id_nxenesi) && (c1.Viti_shkollor == vitiddl1.SelectedItem.Text) && (c2.Id_nxenesi == c.Id_nxenesi) //group c by new { c1.Id_nxenesi, c1.Emri, c1.Mbiemri, c2.Vlera, c.Ulje_1, c.Ulje_2, c.Ulje_3, c.Ulje_4, c.Ulje_5, c.Ulje_6, c.Ulje_7, c.Ulje_8, c.Ulje_9, c.Ulje_10, c.Ulje_11, c.Ulje_12 } // into r // select new {convert.to r.Key.Ulje_1.Value.ToString()*10}; select new { c1.Id_nxenesi, c1.Emri, c1.Mbiemri, c2.Vlera, s1 = c.Ulje_1 * c2.Vlera / 10, c.Ulje_2, c.Ulje_3, c.Ulje_4, c.Ulje_5, c.Ulje_6, c.Ulje_7, c.Ulje_8, c.Ulje_9, c.Ulje_10, c.Ulje_11, c.Ulje_12 }; GridView1.DataSource = sk_nx.Distinct(); GridView1.DataBind(); }
public override void regjistroNxenesin(Nxenesi nxenesi, int klasa, int paralelja) { foreach (var ditar in ditaret) { if (ditar.klasa == klasa) { if (ditar.paralelja == paralelja) { foreach (var lenda in ditar.lendeteDitarit) { Lenda newLenda = new Lenda(""); newLenda.emri = lenda.emri; newLenda.lendaID = lenda.lendaID; nxenesi.lendeteNxenesit.Add(newLenda); } ditar.nxenesit.Add(nxenesi); } } } }
protected void bind1() { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Kestet k = new Kestet(); Nxenesi n = new Nxenesi(); var nxenesit_keste_11 = from d in financa_sh.Nxenesis from c in financa_sh.Kestets where (c.Id_nxenesi == d.Id_nxenesi) && (d.Viti_shkollor == vitiddl1.SelectedItem.Text) group c by new { d.Emri, d.Mbiemri, c.Vlera } into kestet_sum_1 select new { emri1 = kestet_sum_1.Key.Emri, mbiemri1 = kestet_sum_1.Key.Mbiemri, keste_pa = kestet_sum_1.Count(x => x.Paguar == true), keste_paguar = kestet_sum_1.Count(x => ((x.Paguar == false) && (x.Aktiv == true))), vlera_paguar = kestet_sum_1.Key.Vlera * kestet_sum_1.Count(x => ((x.Paguar == false) && (x.Aktiv == true))), vlera_papag = kestet_sum_1.Key.Vlera * kestet_sum_1.Count(x => x.Paguar == true) }; if (nxenesit_keste_11.Count() == 0) { Label9.Text = "0"; } Label11.Text = "0"; GridView2.DataSource = nxenesit_keste_11; GridView2.DataBind(); //Label2.Text = Convert.ToString(kesti_kuq()); //if (nxenesit_keste_1.Count() >= 0) // Button1.Visible = true; //else // Button1.Visible = false; }
protected void vitiddl1_SelectedIndexChanged(object sender, EventArgs e) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Klasaddl.SelectedIndex = 0; Indeksiddl.SelectedIndex = 0; vendos_cmimin(Klasaddl.Text); Nxenesi nxenesit = new Nxenesi(); var nxensi_klasa = from c in financa_sh.Nxenesis where (c.Klasa == Klasaddl.SelectedValue) && (c.Indeksi == Indeksiddl.SelectedValue) && (c.Viti_shkollor == vitiddl1.SelectedValue) let emri = c.Emri let mbiemri = c.Mbiemri select new { c.Id_nxenesi, c.Emri, c.Mbiemri, em = emri + " " + mbiemri, c.Atesia, c.Memesia, c.Ditelindja, c.Nr_amza, c.Nr_tel }; Nxenesiddl.DataSource = nxensi_klasa; Nxenesiddl.DataTextField = "em"; Nxenesiddl.DataValueField = "Id_nxenesi"; Nxenesiddl.DataBind(); Atesialbl.Text = ""; Memesialbl.Text = ""; Amzalbl.Text = ""; Tellbl.Text = ""; skontoddl.Visible = false; TextBox1.Visible = false; Krijo.Visible = false; LinkButton1.Visible = false; komenttxt.Visible = false; Label3.Visible = false; Label4.Visible = false; totalilbl.Text = ""; kestetlbl.Text = ""; krijuar_keste.Visible = false; //fillestarddl.Visible = false; //fillestarlbl.Visible = false; }
protected void bind() { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Kestet k = new Kestet(); Nxenesi n = new Nxenesi(); Transporti t = new Transporti(); var nxenesit_keste_1 = from d in financa_sh.Nxenesis from c in financa_sh.Transportis where (c.Id_nxenesi == d.Id_nxenesi) && (d.Viti_shkollor == vitiddl1.SelectedItem.Text) && (d.Klasa == Klasaddl.SelectedItem.Text) && (d.Indeksi == Indeksiddl.SelectedItem.Text) group c by new { d.Emri, d.Mbiemri } into kestet_sum_1 select new { emri1 = kestet_sum_1.Key.Emri, mbiemri1 = kestet_sum_1.Key.Mbiemri, keste_pa = kestet_sum_1.Count(x => x.Paguar == true), keste_paguar = kestet_sum_1.Count(x => ((x.Paguar == false) && (x.Aktiv == true))) }; GridView1.DataSource = nxenesit_keste_1; GridView1.DataBind(); Label2.Text = Convert.ToString(kesti_kuq()); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { long id = Convert.ToInt64(GridView1.DataKeys[e.RowIndex].Value); DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); var nxensi_id = financa_sh.Nxenesis.Single (p => p.Id_nxenesi == id); nxensi_id.Emri = Convert.ToString(((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox5")).Text); nxensi_id.Mbiemri = Convert.ToString(((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox6")).Text); nxensi_id.Atesia = Convert.ToString(((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox7")).Text); nxensi_id.Memesia = Convert.ToString(((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox8")).Text); nxensi_id.Ditelindja = Convert.ToString(((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox33")).Text); nxensi_id.Nr_amza = Convert.ToString(((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox2")).Text);//**** nxensi_id.Nr_tel = Convert.ToString(((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox9")).Text); nxensi_id.Viti_shkollor = Convert.ToString(((DropDownList)GridView1.Rows[e.RowIndex].FindControl("vitiddl")).SelectedItem.Text); nxensi_id.Klasa = Convert.ToString(((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList11")).SelectedItem.Text); nxensi_id.Indeksi = Convert.ToString(((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList22")).SelectedItem.Text); financa_sh.SubmitChanges(); GridView1.EditIndex = -1; bind(); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); Prenotimi p = new Prenotimi(); if (e.CommandName.Equals("Insert")) { nxenesit.Emri = Convert.ToString(((TextBox)GridView1.FooterRow.FindControl("TextBox5")).Text); nxenesit.Mbiemri = Convert.ToString(((TextBox)GridView1.FooterRow.FindControl("TextBox6")).Text); nxenesit.Atesia = Convert.ToString(((TextBox)GridView1.FooterRow.FindControl("TextBox7")).Text); nxenesit.Memesia = Convert.ToString(((TextBox)GridView1.FooterRow.FindControl("TextBox8")).Text); nxenesit.Ditelindja = Convert.ToString(((TextBox)GridView1.FooterRow.FindControl("TextBox33")).Text); nxenesit.Nr_amza = Convert.ToString(((TextBox)GridView1.FooterRow.FindControl("TextBox2")).Text); nxenesit.Nr_tel = Convert.ToString(((TextBox)GridView1.FooterRow.FindControl("TextBox9")).Text); nxenesit.Viti_shkollor = Convert.ToString(((DropDownList)GridView1.FooterRow.FindControl("vitiddl")).SelectedItem.Text); nxenesit.Klasa = Convert.ToString(((DropDownList)GridView1.FooterRow.FindControl("DropDownList11")).SelectedItem.Text); nxenesit.Indeksi = Convert.ToString(((DropDownList)GridView1.FooterRow.FindControl("DropDownList22")).SelectedItem.Text); financa_sh.Nxenesis.InsertOnSubmit(nxenesit); financa_sh.SubmitChanges(); var nx_fundit = from t in financa_sh.Nxenesis orderby t.Id_nxenesi descending select t.Id_nxenesi; p.Id_nxenesi = nx_fundit.FirstOrDefault(); p.Paguar = false; financa_sh.Prenotimis.InsertOnSubmit(p); financa_sh.SubmitChanges(); var pg_fundit = from t in financa_sh.Pagesas orderby t.Id_pagesa descending select t.Id_pagesa; p.Id_pagesa = pg_fundit.FirstOrDefault(); bind(); } }
//lidh tabelen ne db me gridview public void bind() { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); var nxensi_klasa = from c in financa_sh.Nxenesis from d in financa_sh.Prenotimis where (c.Klasa == DropDownList1.SelectedValue) && (c.Indeksi == DropDownList2.SelectedValue) && (c.Viti_shkollor == vitiddl0.SelectedValue) && (c.Id_nxenesi == d.Id_nxenesi) select new { c.Id_nxenesi, c.Emri, c.Mbiemri, d.Paguar }; GridView1.DataSource = nxensi_klasa; GridView1.Columns[3].Visible = true; GridView1.DataBind(); GridView1.Columns[3].Visible = false; }
protected void Indeksiddl_SelectedIndexChanged(object sender, EventArgs e) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); vendos_cmimin(Klasaddl.Text); var nxensi_klasa = from c in financa_sh.Nxenesis where (c.Klasa == Klasaddl.SelectedValue) && (c.Indeksi == Indeksiddl.SelectedValue) && (c.Viti_shkollor == vitiddl1.SelectedValue) let emri = c.Emri let mbiemri = c.Mbiemri select new { c.Id_nxenesi, c.Emri, c.Mbiemri, em = emri + " " + mbiemri, c.Atesia, c.Memesia, c.Ditelindja, c.Nr_amza, c.Nr_tel }; Nxenesiddl.DataSource = nxensi_klasa; Nxenesiddl.DataTextField = "em"; Nxenesiddl.DataValueField = "Id_nxenesi"; Nxenesiddl.DataBind(); if (Cmimilbl.Text != "Klasa nuk ka cmim !") { if (Nxenesiddl.Text != "") { //vendos gjeneralitetet Atesialbl.Text = "ATESIA : " + nxensi_klasa.FirstOrDefault().Atesia.ToString(); Memesialbl.Text = "MEMESIA : " + nxensi_klasa.FirstOrDefault().Memesia.ToString(); Tellbl.Text = "TEL : " + nxensi_klasa.FirstOrDefault().Nr_tel.ToString(); Amzalbl.Text = "AMZA : " + nxensi_klasa.FirstOrDefault().Nr_amza.ToString(); if (ka_keste(Convert.ToInt32(Nxenesiddl.SelectedValue)) == false) { //bej visible te gjithe kontrollet e tjera krijuar_keste.Visible = false; Krijo.Visible = true; LinkButton1.Visible = true; komenttxt.Visible = true; skontoddl.Visible = true; TextBox1.Visible = true; Label3.Visible = true; Label4.Visible = true; //fillestarddl.Visible = true; //fillestarlbl.Visible = true; //fillestarddl.Text = "1"; totalilbl.Text = "VLERA TOTALE : " + (Convert.ToInt32(Cmimilbl.Text.Remove(0, 10)) - (Convert.ToInt32(Prenotimilbl.Text.Remove(0, 25)))).ToString(); kestetlbl.Text = "VLERA E KESTIT : " + (Convert.ToDecimal(totalilbl.Text.Remove(0, 16)) / 10).ToString(); } else { krijuar_keste.Visible = true; skontoddl.Visible = false; TextBox1.Visible = false; Krijo.Visible = false; LinkButton1.Visible = false; komenttxt.Visible = false; Label3.Visible = false; Label4.Visible = false; totalilbl.Text = ""; kestetlbl.Text = ""; //fillestarddl.Visible = false; //fillestarlbl.Visible = false; } } else { skontoddl.Visible = false; TextBox1.Visible = false; Krijo.Visible = false; LinkButton1.Visible = false; komenttxt.Visible = false; Label3.Visible = false; Label4.Visible = false; totalilbl.Text = ""; kestetlbl.Text = ""; krijuar_keste.Visible = false; //fillestarddl.Visible = false; //fillestarlbl.Visible = false; } } }
protected void Nxenesiddl_SelectedIndexChanged(object sender, EventArgs e) { DataClasses1DataContext financa_sh = new DataClasses1DataContext(); Nxenesi nxenesit = new Nxenesi(); Nxenesiddl.DataBind(); var nxenesi_id = from c in financa_sh.Nxenesis where (c.Id_nxenesi.ToString() == Nxenesiddl.SelectedValue) select new { c.Atesia, c.Memesia, c.Ditelindja, c.Nr_amza, c.Nr_tel }; if (Cmimilbl.Text != "Klasa nuk ka cmim !") { if (Nxenesiddl.Text != "") { //vendos gjeneralitetet Atesialbl.Text = "ATESIA : " + nxenesi_id.FirstOrDefault().Atesia.ToString(); Memesialbl.Text = "MEMESIA : " + nxenesi_id.FirstOrDefault().Memesia.ToString(); Tellbl.Text = "TEL : " + nxenesi_id.FirstOrDefault().Nr_tel.ToString(); Amzalbl.Text = "AMZA : " + nxenesi_id.FirstOrDefault().Nr_amza.ToString(); if (ka_keste(Convert.ToInt32(Nxenesiddl.SelectedValue)) == false) { //bej visible te gjithe kontrollet e tjera krijuar_keste.Visible = false; Krijo.Visible = true; LinkButton1.Visible = true; komenttxt.Visible = true; skontoddl.Visible = true; TextBox1.Visible = true; Label3.Visible = true; Label4.Visible = true; //fillestarddl.Visible = true; //fillestarlbl.Visible = true; //fillestarddl.Text = "1"; totalilbl.Text = "VLERA TOTALE : " + (Convert.ToInt32(Cmimilbl.Text.Remove(0, 10)) - (Convert.ToInt32(Prenotimilbl.Text.Remove(0, 25)))).ToString(); kestetlbl.Text = "VLERA E KESTIT : " + (Convert.ToDecimal(totalilbl.Text.Remove(0, 16)) / 10).ToString(); totalilbl.Visible = true; } else { krijuar_keste.Visible = true; skontoddl.Visible = false; TextBox1.Visible = false; Krijo.Visible = false; LinkButton1.Visible = false; komenttxt.Visible = false; Label3.Visible = false; Label4.Visible = false; totalilbl.Text = ""; kestetlbl.Text = ""; //fillestarddl.Visible = false; //fillestarlbl.Visible = false; } } else { skontoddl.Visible = false; TextBox1.Visible = false; Krijo.Visible = false; LinkButton1.Visible = false; komenttxt.Visible = false; Label3.Visible = false; Label4.Visible = false; totalilbl.Text = ""; kestetlbl.Text = ""; krijuar_keste.Visible = false; //fillestarddl.Visible = false; //fillestarlbl.Visible = false; } } }