Пример #1
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;
                }
            }
        }
Пример #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);
            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();
            }
        }
Пример #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);
        }
Пример #4
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();
     }
 }
Пример #5
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);
         }
     }
 }
Пример #6
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);
                        }
                    }
                }
            }
        }
Пример #7
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", "********");
        }
Пример #8
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);
        }
Пример #9
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);
     }
 }
Пример #10
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();
            }
        }
Пример #11
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);
            }
        }
Пример #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;
        }
Пример #13
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();
        }
Пример #14
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);
            }
        }
Пример #15
0
        public FormAktualny_stav()
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

            zamestananec = zg.Select();

            InitializeComponent();
            pracoviskoCombo_Load();
        }
Пример #16
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);
                }
            }
        }
Пример #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();
                    }
                }
            }
        }
Пример #18
0
        public FormEmpList()
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

            z = zg.Select();
            InitializeComponent();
            loadList();
        }
Пример #19
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;
        }
Пример #20
0
        public FormCreateProject()
        {
            ZamestnanecFactory zamestnanecFactory = new ZamestnanecFactory();
            ZamestnanecGateway <Zamestnanec> zg   = (ZamestnanecGateway <Zamestnanec>)zamestnanecFactory.GetZamestnanec();

            z = zg.Select();
            InitializeComponent();
            empLoad();
        }