Exemplo n.º 1
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();
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();



            if (Session["ID"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }
            zamestnanec    = zg.Select_id(int.Parse((Session["ID"].ToString())));
            newZamestnanec = zamestnanec;

            nameElement.Attributes.Add("placeholder", zamestnanec.Name);
            surnameElement.Attributes.Add("placeholder", zamestnanec.LastName);
            perIdNumElement.Attributes.Add("placeholder", zamestnanec.PerIdNum.ToString());
            adressElement.Attributes.Add("placeholder", zamestnanec.Adress);
            sexElement.Attributes.Add("placeholder", zamestnanec.Sex);
            workGroupElement.Attributes.Add("placeholder", zamestnanec.WorkGroup.ToString());
            projectElement.Attributes.Add("placeholder", zamestnanec.IdProject.ToString());
            positionElemnt.Attributes.Add("placeholder", zamestnanec.Group.ToString());
            mailElement.Attributes.Add("placeholder", zamestnanec.Mail);
            password1.Attributes.Add("placeholder", "********");
            password2.Attributes.Add("placeholder", "********");
            oldPasswordElement.Attributes.Add("placeholder", "********");
        }
Exemplo n.º 3
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.º 4
0
        public FormEmpList()
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

            z = zg.Select();
            InitializeComponent();
            loadList();
        }
Exemplo n.º 5
0
        public FormCreateProject()
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

            z = zg.Select();
            InitializeComponent();
            empLoad();
        }
Exemplo n.º 6
0
        public FormAktualny_stav()
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

            zamestananec = zg.Select();

            InitializeComponent();
            pracoviskoCombo_Load();
        }
Exemplo n.º 7
0
        public void show()
        {
            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;
                                b       = true;
                            }

                            counter++;
                        }
                        if (b)
                        {
                            active.Add(t);
                        }
                    }
                }
            }
            BindingList <Active> Bactive = new BindingList <Active>(active);

            gridAktivita.AutoGenerateColumns = false;
            gridAktivita.DataSource          = Bactive;
        }
Exemplo n.º 8
0
 protected void SaveRecord()
 {
     foreach (var i in p)
     {
         if (i.Name.Equals(projektCombo.Text, StringComparison.Ordinal))
         {
             zamestnanec.IdProject = i.RecordId;
             ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
             ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();
             zg.Update(zamestnanec);
         }
     }
 }
Exemplo n.º 9
0
        public FormAttendance()
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

            z = zg.Select();
            PracoviskoFactory pracoviskoFactory = new PracoviskoFactory();
            PracoviskoGateway <Pracovisko> pg   = (PracoviskoGateway <Pracovisko>)pracoviskoFactory.GetPracovisko();

            p = pg.Select();
            InitializeComponent();
            loadWork();
        }
Exemplo n.º 10
0
        protected void profileConfirmButton_Click1(object sender, EventArgs e)
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

            bool   toInsert     = true;
            string errorMessage = "";

            if (!string.IsNullOrWhiteSpace(nameElement.Text))
            {
                newZamestnanec.Name = nameElement.Text;
            }
            if (!string.IsNullOrWhiteSpace(surnameElement.Text))
            {
                newZamestnanec.LastName = surnameElement.Text;
            }
            if (!string.IsNullOrWhiteSpace(mailElement.Text))
            {
                if (Functions.IsValidEmail(mailElement.Text))
                {
                    newZamestnanec.Mail = mailElement.Text;
                }
                else
                {
                    toInsert     = false;
                    errorMessage = "Entered Mail is invalid.";
                }
            }
            if (!string.IsNullOrWhiteSpace(password1.Text) && !string.IsNullOrWhiteSpace(password2.Text))
            {
                if (password1.Text == password2.Text && password1.Text.Length > 5 && oldPasswordElement.Text == zamestnanec.Heslo)
                {
                    newZamestnanec.Heslo = password1.Text;
                }
                else
                {
                    errorMessage = "An error occured, password is too short or does not match.";
                    toInsert     = false;
                }
            }

            if (toInsert)
            {
                zg.Update(newZamestnanec);
                Response.Redirect("~/Profile.aspx");
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('" + errorMessage + "');window.location ='ChangeProfile.aspx';", true);
            }
        }
Exemplo n.º 11
0
 public void OpenRecord(object primaryKey)
 {
     if (primaryKey != null)
     {
         int idZamestnanca = (int)primaryKey;
         ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
         ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();
         zamestnanec = zg.Select_id(idZamestnanca);
     }
     else
     {
         zamestnanec = new Zamestnanec();
     }
 }
Exemplo n.º 12
0
        private void button1_Click(object sender, EventArgs e)
        {
            step = new Collection <Step>();
            string a      = comboZam.Text;
            string result = "1";

            string[] word = a.Split(' ');
            foreach (var i in z)
            {
                if (word[0].Equals(i.Name, StringComparison.Ordinal) && word[1].Equals(i.LastName, StringComparison.Ordinal))
                {
                    ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
                    ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();
                    if (s < k || i != null)
                    {
                        result = zg.CheckEmp(i.RecordId, s, k, null);
                    }
                    else
                    {
                        MessageBox.Show("Choose dates!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }

            string[] word1 = result.Split(';');
            foreach (var j in word1)
            {
                string[] word2   = j.Split(',');
                int      counter = 0;
                Step     steps   = new Step();
                foreach (var k in word2)
                {
                    if (counter == 0)
                    {
                        steps.Date = k;
                    }
                    if (counter == 1)
                    {
                        steps.Status = k;
                    }
                    counter++;
                }
                step.Add(steps);
            }
            BindingList <Step> Bactive = new BindingList <Step>(step);

            gridStep.AutoGenerateColumns = false;
            gridStep.DataSource          = Bactive;
        }
Exemplo n.º 13
0
        private void gridAktivita_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

            zamestananec = zg.Select();
            Active t = GetSelectedData();

            foreach (var i in zamestananec)
            {
                if (t.Name.Equals(i.Name, StringComparison.Ordinal) && t.Surname.Equals(i.LastName, StringComparison.Ordinal))
                {
                    info.Text = "Meno: " + i.Name + "\n" + "Prievisko: " + i.LastName + "\n" + "Rodne cislo: " + i.PerIdNum + "\n" + "Bydlisko: " + i.Adress + "\n" + "Pohlavie: " + i.Sex;
                }
            }
        }
Exemplo n.º 14
0
        public bool OpenRecord(object primaryKey)
        {
            if (primaryKey != null)
            {
                int idZamestnanca = (int)primaryKey;
                ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
                ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();
                zamestnanec = zg.Select_id(idZamestnanca);

                newRecord = false;
            }
            else
            {
                zamestnanec = new Zamestnanec();
                newRecord   = true;
            }
            BindData();
            return(true);
        }
Exemplo n.º 15
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

            string login    = String.Format("{0}", Request.Form["loginInput"]);
            string password = String.Format("{0}", Request.Form["passwordInput"]);

            Zamestnanec zamestnanec = new Zamestnanec();

            zamestnanec.Heslo = password;
            zamestnanec.Mail  = login;
            if (string.IsNullOrWhiteSpace(login))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('No mail was entered');window.location ='ChangeProfile.aspx';", true);
            }
            else if (!Functions.IsValidEmail(login))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('You entered non-valid email address');window.location ='ChangeProfile.aspx';", true);
            }
            else if (string.IsNullOrWhiteSpace(password))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('You entered non-valid password');window.location ='ChangeProfile.aspx';", true);
            }
            else
            {
                Zamestnanec za = zg.CheckPassword(zamestnanec);
                if (za != null)
                {
                    Session["ID"]    = za.RecordId;
                    Session["login"] = za.Mail;
                    Response.Redirect("~/Home.aspx");
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Wrong credentials!');window.location ='ChangeProfile.aspx';", true);
                }
            }
        }
Exemplo n.º 16
0
        private void acceptButton_Click(object sender, EventArgs e)
        {
            Zamestnanec        zamestnanec        = new Zamestnanec(0, mailInput.Text, passwordInput.Text);
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();
            Zamestnanec zam;

            if (Functions.IsValidEmail(mailInput.Text))
            {
                if (passwordInput.Text.Length > 5)
                {
                    zam = zg.CheckPassword(zamestnanec);
                    if (zg.CheckPassword(zamestnanec) != null)
                    {
                        if (zam.Group == 12)
                        {
                            this.Dispose();
                        }
                        else
                        {
                            MessageBox.Show("You have not  permission!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else
                    {
                        MessageBox.Show("You enetered wrong credentials, try again!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Password is too short!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("You entered invalid mail address!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 17
0
        private void gridAktivita_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (gridAktivita.Columns[e.ColumnIndex].Name == "Pritomny")
            {
                ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
                ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();
                zamestananec = zg.Select();
                Active   t     = GetSelectedData();
                DateTime date1 = DateTime.Now;

                foreach (var i in zamestananec)
                {
                    if (t.Name.Equals(i.Name, StringComparison.Ordinal) && t.Surname.Equals(i.LastName, StringComparison.Ordinal))
                    {
                        Historia_pristupuFactory historia_pristupuFactory = new Historia_pristupuFactory();
                        Historia_pristupuGateway <Historia_pristupu> hg   = (Historia_pristupuGateway <Historia_pristupu>)historia_pristupuFactory.GetHistoria_pristupu();
                        Historia_pristupu h = new Historia_pristupu(date1, i.RecordId, 37);
                        hg.Insert(h);
                        show();
                    }
                }
            }
        }
Exemplo n.º 18
0
 protected bool SaveRecord()
 {
     if (GetData())
     {
         if (newRecord)
         {
             ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
             ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();
             zg.Insert(zamestnanec);
         }
         else
         {
             ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
             ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();
             zg.Update(zamestnanec);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 19
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.º 20
0
        private void button1_Click(object sender, EventArgs e)
        {
            foreach (var i in w)
            {
                if (i.Name.Equals(comboWork.Text, StringComparison.Ordinal))
                {
                    z.WorkGroup = i.RecordId;
                }
            }
            foreach (var i in p)
            {
                if (i.Name.Equals(comboProject.Text, StringComparison.Ordinal))
                {
                    z.IdProject = i.RecordId;
                }
            }
            foreach (var i in s)
            {
                if (i.Name.Equals(comboGroup.Text, StringComparison.Ordinal))
                {
                    z.Group = i.RecordId;
                }
            }
            z.Sex   = comboSex.Text;
            z.Mail  = textBox1.Text;
            z.Heslo = textBox2.Text;
            z.Vypis = Convert.ToInt32(textBox3.Text);
            bool   vall = true;
            string a    = "";

            if (z.Name.Equals(a))
            {
                meno.Text = "Prosim zadajte meno";
                vall      = false;
            }
            else
            {
                meno.Text = "";
            }
            if (z.LastName.Equals(a))
            {
                prie.Text = "Prosim zadajte priezvisko";
                vall      = false;
            }
            else
            {
                prie.Text = "";
            }
            if (z.Adress.Equals(a))
            {
                adre.Text = "Prosim zadajte adresu";
                vall      = false;
            }
            else
            {
                adre.Text = "";
            }
            if (z.PerIdNum == 0)
            {
                rodn.Text = "Prosim zadajte rodne cislo";
                vall      = false;
            }
            else
            {
                rodn.Text = "";
            }
            if (a.Equals(comboWork.Text))
            {
                work.Text = "Prosim vyberte pracovisko";
                vall      = false;
            }
            else
            {
                work.Text = "";
            }
            if (a.Equals(comboGroup.Text))
            {
                gru.Text = "Prosim vyberte skupinu";
                vall     = false;
            }
            else
            {
                gru.Text = "";
            }
            if (a.Equals(comboProject.Text))

            {
                ptoj.Text = "Prosim vyberte projekt";
                vall      = false;
            }
            else
            {
                ptoj.Text = "";
            }
            if (a.Equals(comboSex.Text))
            {
                pohl.Text = "Prosim vyberte pohlavie";
                vall      = false;
            }
            else
            {
                pohl.Text = "";
            }
            if (z.Mail.Equals(a))
            {
                lmail.Text = "Prosim zadajte Mail";
                vall       = false;
            }
            else
            {
                lmail.Text = "";
            }
            if (z.Heslo.Equals(a))
            {
                lheslo.Text = "Prosim zadajte heslo";
                vall        = false;
            }
            else
            {
                lheslo.Text = "";
            }
            if (z.Vypis == 0)
            {
                lvypis.Text = "Prosim zadajte priezvisko";
                vall        = false;
            }
            else
            {
                lvypis.Text = "";
            }

            if (vall)
            {
                ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
                ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

                zg.Insert(z);

                Close();
            }
        }