Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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();
            }
        }