Esempio n. 1
0
        internal void InitEdit(int id, Form_Seznam_Zamestnanec parent)
        {
            this._parent = parent;
            DataTable dt_zam = dt.getZamestnanec(id);

            this.Id = id;
            this.button_Pridat.Text = "Upravit";

            this.textBox_Jmeno.Text          = dt_zam.Rows[0]["Jmeno"].ToString();
            this.textBox_Prijmeni.Text       = dt_zam.Rows[0]["Prijmeni"].ToString();
            this.textBox_Pracovni_Email.Text = dt_zam.Rows[0]["Pracovni_Email"].ToString();
            this.textBox_Soukromy_Email.Text = dt_zam.Rows[0]["Soukromy_Email"].ToString();
            this.textBox_Uvazek.Text         = dt_zam.Rows[0]["Uvazek"].ToString();

            for (int i = 0; i < comboBox_Doktorant.Items.Count; i++)
            {
                if ((comboBox_Doktorant.Items[i] as combobox_item).id == Convert.ToInt32(Convert.ToBoolean(dt_zam.Rows[0]["Doktorand"].ToString())))
                {
                    comboBox_Doktorant.SelectedIndex = i;
                    comboBox_Doktorant.SelectedItem  = comboBox_Doktorant.Items[i];
                }
            }

            Uvazky    uvazky    = new Uvazky(true);
            double    body      = 0;
            DataTable dataTable = dt.getPracovniStitekNJZamestnanec(id);

            foreach (DataRow drSt in dataTable.Rows)
            {
                body += uvazky.getBody(
                    (TypStitek)(int)drSt.ItemArray[dataTable.Columns.IndexOf("Typ_Stitek")],
                    (TypJazyk)(int)drSt.ItemArray[dataTable.Columns.IndexOf("Jazyk")],
                    Convert.ToDouble(drSt.ItemArray[dataTable.Columns.IndexOf("Pocet_Hodin")]),
                    Convert.ToDouble(drSt.ItemArray[dataTable.Columns.IndexOf("Uvazek")])
                    );
            }
            ;

            this.textBox_Pracovni_Body.Text = body.ToString();

            double body_bez_AJ = 0;

            foreach (DataRow drSt in dataTable.Rows)
            {
                body_bez_AJ += uvazky.getBody(
                    (TypStitek)(int)drSt.ItemArray[dataTable.Columns.IndexOf("Typ_Stitek")],
                    (TypJazyk)(int)drSt.ItemArray[dataTable.Columns.IndexOf("Jazyk")],
                    Convert.ToDouble(drSt.ItemArray[dataTable.Columns.IndexOf("Pocet_Hodin")]),
                    Convert.ToDouble(drSt.ItemArray[dataTable.Columns.IndexOf("Uvazek")]),
                    true
                    );
            }
            ;

            this.textBox_Pracovni_Body_Bez_AJ.Text = body_bez_AJ.ToString();
        }
Esempio n. 2
0
        private void Form_Pridat_Stitek_Load(object sender, EventArgs e)
        {
            DataTable            dataT_Zamestnanci = DB_Data.getZamestnanec();
            DataTable            dataT_Jazyky      = DB_Data.getJazyk();
            DataTable            dataT_Typ_Stitek  = DB_Data.getTypStitek();
            DataTable            dataT_Predmet     = DB_Data.getPredmet();
            List <combobox_item> col_Zamestnanec   = new List <combobox_item>();
            List <combobox_item> col_Jazyky        = new List <combobox_item>();
            List <combobox_item> col_Typ_Stitek    = new List <combobox_item>();
            List <combobox_item> col_Predmet       = new List <combobox_item>();


            foreach (DataRow dr in dataT_Zamestnanci.Rows)
            {
                col_Zamestnanec.Add(new combobox_item {
                    id = Convert.ToInt32(dr.ItemArray[0]), zkratka = string.Empty, nazev = dr.ItemArray[1].ToString().Trim() + " " + dr.ItemArray[2].ToString().Trim()
                });
            }

            foreach (DataRow dr in dataT_Jazyky.Rows)
            {
                col_Jazyky.Add(new combobox_item {
                    id = Convert.ToInt32(dr.ItemArray[0]), zkratka = dr.ItemArray[1].ToString().Trim(), nazev = dr.ItemArray[2].ToString().Trim()
                });
            }

            foreach (DataRow dr in dataT_Typ_Stitek.Rows)
            {
                col_Typ_Stitek.Add(new combobox_item {
                    id = Convert.ToInt32(dr.ItemArray[0]), zkratka = dr.ItemArray[1].ToString().Trim(), nazev = dr.ItemArray[2].ToString().Trim()
                });
            }

            foreach (DataRow dr in dataT_Predmet.Rows)
            {
                col_Predmet.Add(new combobox_item {
                    id = Convert.ToInt32(dr.ItemArray[0]), zkratka = dr.ItemArray[1].ToString().Trim(), nazev = dr.ItemArray[2].ToString().Trim()
                });
            }



            //Zdroje comboboxů
            comboBox_Zamestnanec.DataSource = col_Zamestnanec;
            comboBox_Jazyk.DataSource       = col_Jazyky;
            comboBox_Typ_Stitek.DataSource  = col_Typ_Stitek;
            comboBox_Predmet.DataSource     = col_Predmet;

            //Select default empty value
            comboBox_Zamestnanec.SelectedIndex = -1;
            comboBox_Jazyk.SelectedIndex       = -1;
            comboBox_Typ_Stitek.SelectedIndex  = -1;
            comboBox_Predmet.SelectedIndex     = -1;
        }
        public void Form_Seznam_Zamestnanec_Load(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            DataTable dbtable = DB_Data.getZamestnanec();
            int       i       = 0;
            Uvazky    uvazky  = new Uvazky(true);

            foreach (DataRow dr in dbtable.Rows)
            {
                double    body      = 0;
                DataTable dataTable = DB_Data.getPracovniStitekNJZamestnanec(Convert.ToInt32(dr.ItemArray[0]));
                foreach (DataRow drSt in dataTable.Rows)
                {
                    body += uvazky.getBody(
                        (TypStitek)(int)drSt.ItemArray[dataTable.Columns.IndexOf("Typ_Stitek")],
                        (TypJazyk)(int)drSt.ItemArray[dataTable.Columns.IndexOf("Jazyk")],
                        Convert.ToDouble(drSt.ItemArray[dataTable.Columns.IndexOf("Pocet_Hodin")]),
                        Convert.ToDouble(drSt.ItemArray[dataTable.Columns.IndexOf("Uvazek")])
                        );
                }

                DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[i++].Clone();
                row.Cells[0].Value = Convert.ToInt32(dr.ItemArray[0]);
                row.Cells[1].Value = dr.ItemArray[1].ToString() + " " + dr.ItemArray[2].ToString();
                row.Cells[2].Value = dr.ItemArray[3];
                row.Cells[3].Value = dr.ItemArray[4];
                row.Cells[4].Value = (bool)dr.ItemArray[5] ? "Ano" : "Ne";
                row.Cells[5].Value = dr.ItemArray[6];


                row.Cells[6].Value = body;
                //row.Cells[2].Value = dt.getNazevTypStitek(Convert.ToInt32(dr.ItemArray[3]));
                //if (dr.ItemArray[1].ToString() != string.Empty)
                //    row.Cells[3].Value = dt.getZamestnanecJmeno(Convert.ToInt32(dr.ItemArray[1]));
                dataGridView1.Rows.Add(row);
            }
        }
Esempio n. 4
0
        public void InitValue(int Id, string Nazev, string typ, string nazev_zamestnanec)
        {
            DataTable            dataT_zamestnanci = dt.getZamestnanec();
            List <combobox_item> col_Zamestnanec   = new List <combobox_item>();


            foreach (DataRow dr in dataT_zamestnanci.Rows)
            {
                col_Zamestnanec.Add(new combobox_item {
                    id = Convert.ToInt32(dr.ItemArray[0]), zkratka = string.Empty, nazev = dr.ItemArray[1].ToString().Trim() + " " + dr.ItemArray[2].ToString().Trim()
                });
            }


            //Zdroje comboboxů
            comboBox_Zamestnanec.DataSource = col_Zamestnanec;

            //Select default empty value
            comboBox_Zamestnanec.SelectedIndex = -1;

            this.Id            = Id;
            this.textBox1.Text = Nazev;
            this.textBox2.Text = typ;

            if (nazev_zamestnanec != String.Empty)
            {
                for (int i = 0; i < comboBox_Zamestnanec.Items.Count; i++)
                {
                    if ((comboBox_Zamestnanec.Items[i] as combobox_item).nazev.ToLower().Trim() == nazev_zamestnanec.ToLower().Trim())
                    {
                        comboBox_Zamestnanec.SelectedIndex = i;
                        comboBox_Zamestnanec.SelectedItem  = comboBox_Zamestnanec.Items[i];
                    }
                }
            }
        }