protected void uploadButton_Click1(object sender, EventArgs e) { ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory(); ZamestnanecGateway <Zamestnanec> zg = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec(); Zamestnanec zamestnanec = zg.Select_id(int.Parse((Session["ID"].ToString()))); NepritomnostFactory nepritomnostFactory = new NepritomnostFactory(); NepritomnostGateway <Nepritomnost> ng = (NepritomnostGateway <Nepritomnost>)nepritomnostFactory.GetNepritomnost(); Collection <Nepritomnost> nepritomnost = ng.Select_id_zam(zamestnanec.RecordId); foreach (Nepritomnost h in nepritomnost) { if (h.Datum.ToString() == DropDownList1.SelectedItem.ToString()) { nesch.Nepritomnost = h.RecordId; } } NeschopenkaFactory neschopenkaFactory = new NeschopenkaFactory(); NeschopenkaGateway <Neschopenka> ne = (NeschopenkaGateway <Neschopenka>)neschopenkaFactory.GetNeschopenka(); Collection <Neschopenka> za = ne.Select(); int id = 0; foreach (var nep in za) { if (nep.RecordId > id) { id = nep.RecordId; } } id++; nesch.Text = TextBox1.Text.ToString(); nesch.Datum = DateTime.Now; ne.Insert(nesch); }
protected void Page_Load(object sender, EventArgs e) { ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory(); ZamestnanecGateway <Zamestnanec> zg = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec(); Zamestnanec zamestnanec = zg.Select_id(int.Parse((Session["ID"].ToString()))); NepritomnostFactory nepritomnostFactory = new NepritomnostFactory(); NepritomnostGateway <Nepritomnost> ng = (NepritomnostGateway <Nepritomnost>)nepritomnostFactory.GetNepritomnost(); Collection <Nepritomnost> nepritomnost = ng.Select_id_zam(zamestnanec.RecordId); datasick = new Collection <SickNote>(); NeschopenkaFactory neschopenkaFactory = new NeschopenkaFactory(); NeschopenkaGateway <Neschopenka> ne = (NeschopenkaGateway <Neschopenka>)neschopenkaFactory.GetNeschopenka(); Collection <Neschopenka> za = ne.Select(); foreach (var i in nepritomnost) { foreach (var a in za) { if (a.Nepritomnost == i.RecordId) { datasick.Add(new SickNote(i.Datum, a.Datum, a.Text)); } } } if (!IsPostBack) { GridView2.DataSource = datasick; GridView2.DataBind(); } }
private void button1_Click_2(object sender, EventArgs e) { string a; Collection <Active> active = new Collection <Active>(); foreach (var i in pracovisko) { if (i.Name.Equals(pracoviskoCombo.Text, StringComparison.Ordinal)) { ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory(); ZamestnanecGateway <Zamestnanec> zg = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec(); a = zg.AktualnePritomny(i.RecordId, null); string[] words = a.Split(';'); foreach (var word in words) { string[] words2 = word.Split(','); int counter = 0; bool b = false; Active t = new Active(); foreach (var word1 in words2) { if (counter == 0) { t.Name = word1; } if (counter == 1) { t.Surname = word1; } if (counter == 2) { t.State = word1; if (t.State == "Nepritomny") { NepritomnostFactory nepritomnostFactory = new NepritomnostFactory(); NepritomnostGateway <Nepritomnost> ng = (NepritomnostGateway <Nepritomnost>)nepritomnostFactory.GetNepritomnost(); Zamestnanec z = zg.Select_name(t.Name, t.Surname); Collection <Nepritomnost> za = ng.Select(); int id = 0; foreach (var nep in za) { if (nep.RecordId > id) { id = nep.RecordId; } } id++; Nepritomnost n = new Nepritomnost(id, z.RecordId, DateTime.Now); ng.Insert(n); } b = true; } counter++; } if (b) { active.Add(t); } } } } }