Exemplo 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);
        }
Exemplo n.º 2
0
        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);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
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);
            Collection <DateTime> datesick1 = new Collection <DateTime>();

            Collection <Active> datasick           = new Collection <Active>();
            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 Active(i.Datum, "Send"));
                    }
                    else
                    {
                        datasick.Add(new Active(i.Datum, "Nothing"));
                        datesick1.Add(i.Datum);
                    }
                }
            }
            if (!IsPostBack)
            {
                GridView1.DataSource = datasick;
                GridView1.DataBind();
                DropDownList1.DataSource = datesick1;
                DropDownList1.DataBind();
            }
        }