コード例 #1
0
        /*
         * Для добавления командировки
         * **/
        public KomandirovkaForm()
        {
            Donloading waitForm = new Donloading();

            waitForm.Show(this);
            model   = new Model1();
            allOrgs = model.TRIP_ORG;
            InitializeComponent();
            UpdatePlaces();
            CounrtyColumn.DataSource = cities.Keys.ToList();
            waitForm.Close();
        }
コード例 #2
0
ファイル: Shtatka.cs プロジェクト: Th3Ch3shir3Cat/comand_dev
        public async Task RunLoad()
        {
            model = new Model1();
            var form = new Donloading();

            form.Show();
            numerusPeople    = 0;
            totalInMonth1    = 0;
            strginShtatRasps = new List <StringShtatRasp>();
            string numdoc = numDocFromChoose.ToString();
            IQueryable <STR_SHTAT_RASP> strShtatRasps = model.STR_SHTAT_RASP;

            strShtatRasps = strShtatRasps.Where(rasp => rasp.SHTAT_RASP.number == numdoc);

            foreach (STR_SHTAT_RASP strShtatRasp in strShtatRasps)
            {
                strginShtatRasps.Add(setDataInString(new StringShtatRasp(), Convert.ToInt32(strShtatRasp.PK_STROKA), strShtatRasp.PODRAZDELORG.NAME,
                                                     strShtatRasp.PODRAZDELORG.CODE, strShtatRasp.JOB_POSITION.NAME, strShtatRasp.COUNT_STUFF.ToString(),
                                                     Convert.ToDouble(strShtatRasp.TARIFF), Convert.ToDouble(strShtatRasp.NADBAVKA1), Convert.ToDouble(strShtatRasp.NADBAVKA2), Convert.ToDouble(strShtatRasp.NADBAVKA3),
                                                     strShtatRasp.NOTE));
                numerusPeople += Convert.ToInt32(strShtatRasp.COUNT_STUFF);
                totalInMonth1 += Convert.ToDouble(strShtatRasp.TARIFF) + Convert.ToDouble(strShtatRasp.NADBAVKA1) +
                                 Convert.ToDouble(strShtatRasp.NADBAVKA2) + Convert.ToDouble(strShtatRasp.NADBAVKA3);
            }
            dataGridView1.DataSource                  = null;
            dataGridView1.DataSource                  = strginShtatRasps;
            dataGridView1.Columns[1].Width            = 150;
            dataGridView1.Columns[2].Width            = 65;
            dataGridView1.Columns[3].Width            = 165;
            dataGridView1.Columns[4].Width            = 72;
            dataGridView1.Columns[5].Width            = 85;
            dataGridView1.Columns[6].Width            = 92;
            dataGridView1.Columns[7].Width            = 92;
            dataGridView1.Columns[8].Width            = 92;
            dataGridView1.Columns[9].Width            = 151;
            dataGridView1.Columns[10].Width           = 90;
            dataGridView1.Columns[11].Visible         = false;
            dataGridView1.Columns["stringId"].Visible = false;

            //Запрос для заполнения полей номер документа и дата составления
            IQueryable <SHTAT_RASP> query1 = model.SHTAT_RASP;

            query1 = query1.Where(rasp => rasp.number == numdoc);
            //Заполняем поля номер документа и дата составления
            numDoc    = "";
            _dateTime = new DateTime();
            foreach (SHTAT_RASP ourOrg in query1)
            {
                numDoc    = ourOrg.number;
                _dateTime = Convert.ToDateTime(ourOrg.CREATEDATE);
                PK_ST     = Convert.ToInt32(ourOrg.PK_SHTAT_RASP);
            }

            numberDoc.Text  = numDoc;
            dataCreate.Text = _dateTime.ToString();

            //Заполним нэйм организации
            IQueryable <OUR_ORG> query3 = model.OUR_ORG;

            List <OUR_ORG> ourOrgs = new List <OUR_ORG>();

            foreach (OUR_ORG ourOrg in query3)
            {
                ourOrgs.Add(ourOrg);
            }

            nameOraganization = ourOrgs[query3.Count() - 1].NAME;
            okpo = ourOrgs[query3.Count() - 1].OKPO;
            nameOrganization.Text = nameOraganization;
            textBox22.Text        = okpo;
            numerusEd.Text        = numerusPeople.ToString();
            totalEdtx.Text        = numerusPeople.ToString();
            totalInMoth.Text      = totalInMonth1.ToString();

            IQueryable <PERSONCARD> query4 = model.PERSONCARD;

            query4 = query4.Where(personcard => personcard.JOB_POSITION_PK_JOB_POS == 147);
            List <PERSONCARD> personcards = new List <PERSONCARD>();

            foreach (PERSONCARD personcard in query4)
            {
                personcards.Add(personcard);
            }

            rashPodpis.Text   = personcards[0].SURNAME + " " + personcards[0].NAME + " " + personcards[0].MIDDLENAME;
            mainDolgnost.Text = personcards[0].JOB_POSITION.NAME;
            personcards       = new List <PERSONCARD>();
            query4            = model.PERSONCARD;
            query4            = query4.Where(personcard => personcard.JOB_POSITION_PK_JOB_POS == 91);
            foreach (PERSONCARD personcard in query4)
            {
                personcards.Add(personcard);
            }

            rashPodBuh.Text = personcards[0].SURNAME + " " + personcards[0].NAME + " " + personcards[0].MIDDLENAME;

            form.Close();
        }
コード例 #3
0
ファイル: Shtatka.cs プロジェクト: Th3Ch3shir3Cat/comand_dev
        public async Task RunLoadShtatkaToBaza()
        {
            var form = new Donloading();

            form.Show();
            IQueryable <STR_SHTAT_RASP> queryForStrShtatRasp = model.STR_SHTAT_RASP;
            int countStrInST = queryForStrShtatRasp.Count() + 2;

            newShtat = new SHTAT_RASP();
            newShtat.PK_SHTAT_RASP = countShtat + 1;
            newShtat.number        = numberDoc.Text;
            newShtat.CREATEDATE    = DateTime.Parse(dataCreate.Text);
            model.SHTAT_RASP.Add(newShtat);
            model.SaveChanges();
            IQueryable <PODRAZDELORG> queryForPodr = model.PODRAZDELORG;

            foreach (PODRAZDELORG podrazdelorg in queryForPodr)
            {
                if (!podrazdelorg.NAME.Equals("Наименование органа управления / структурного подразделения"))
                {
                    try
                    {
                        podrazd_pk.Add(podrazdelorg.NAME, Convert.ToInt32(podrazdelorg.PK_PODRAZDEL));
                    }
                    catch (ArgumentException)
                    {
                    }
                }
            }

            IQueryable <JOB_POSITION> queryForJob = model.JOB_POSITION;

            foreach (JOB_POSITION job in queryForJob)
            {
                try
                {
                    dolg_pk.Add(job.NAME, Convert.ToInt32(job.PK_JOB_POS));
                }
                catch (ArgumentException)
                {
                }
            }
            for (int i = 0; i < strginShtatRasps.Count(); i++)
            {
                newStr           = new STR_SHTAT_RASP();
                newStr.PK_STROKA = countStrInST++;
                try
                {
                    newStr.PK_PODRAZDEL = Convert.ToInt32(podrazd_pk[strginShtatRasps[i].stringName]);
                }
                catch (KeyNotFoundException)
                {
                    MessageBox.Show("Подразделения " + strginShtatRasps[i].stringName + " не найдено.\n             Необходимо внести данные");
                    AddPodrazdel addpodrazdel = new AddPodrazdel(this, podrazd_pk, queryForPodr.Count() + 1);
                    addpodrazdel.NamePodrazdel.Text = strginShtatRasps[i].stringName;
                    addpodrazdel.ShowDialog();
                    try
                    {
                        newStr.PK_PODRAZDEL = Convert.ToInt32(podrazd_pk[strginShtatRasps[i].stringName]);
                    }
                    catch (KeyNotFoundException)
                    {
                        MessageBox.Show("Не получилось");
                    }
                }

                try
                {
                    newStr.PK_JOB_POS = Convert.ToInt32(dolg_pk[strginShtatRasps[i].stringDolgnost]);
                }catch (KeyNotFoundException)
                {
                    MessageBox.Show("Должность " + strginShtatRasps[i].stringDolgnost + " не найдена.\n             Необходимо внести данные");
                    AddJobPosition addJobPosition = new AddJobPosition(this, queryForJob.Count() + 1, dolg_pk);
                    addJobPosition.NameJobPosition.Text = strginShtatRasps[i].stringDolgnost;
                    addJobPosition.ShowDialog();
                    try
                    {
                        newStr.PK_JOB_POS = Convert.ToInt32(dolg_pk[strginShtatRasps[i].stringDolgnost]);
                    }
                    catch (KeyNotFoundException)
                    {
                        MessageBox.Show("Не получилось");
                    }
                }

                newStr.COUNT_STUFF = Convert.ToInt32(strginShtatRasps[i].stringKolEd);
                newStr.TARIFF      = Convert.ToInt32(strginShtatRasps[i].stringoklad);
                newStr.NADBAVKA1   = (Decimal)strginShtatRasps[i].stringNad1;
                newStr.NADBAVKA2   = (Decimal)strginShtatRasps[i].stringNad2;
                newStr.NADBAVKA3   = (Decimal)strginShtatRasps[i].stringNad3;
                newStr.NOTE        = strginShtatRasps[i].stringPrim;
                newStr.SHTAT_RASP_PK_SHTAT_RASP = countShtat + 1;
                model.STR_SHTAT_RASP.Add(newStr);
            }


            model.SaveChanges();
            PK_ST = countShtat + 1;
            form.Close();
            MessageBox.Show("Добавленно");
        }
コード例 #4
0
ファイル: Shtatka.cs プロジェクト: Th3Ch3shir3Cat/comand_dev
        private async Task Run()
        {
            numerusPeople = 0;
            totalInMonth1 = 0;
            var form = new Donloading();

            form.Show();
            strginShtatRasps = new List <StringShtatRasp>();
            Worksheet excelsheets = excelappworkbooks.Worksheets.Item[1];

            nameOrganization.Text = ((excelsheets.Cells[5, 1]).Value ?? string.Empty).ToString();
            numberDoc.Text        = ((excelsheets.Cells[9, 69]).Value ?? string.Empty).ToString();
            dataCreate.Text       = ((excelsheets.Cells[9, 87]).Value ?? string.Empty).ToString();
            period.Text           = ((excelsheets.Cells[11, 36]).Value ?? string.Empty).ToString();
            day.Text          = ((excelsheets.Cells[11, 52]).Value ?? string.Empty).ToString();
            month.Text        = ((excelsheets.Cells[11, 57]).Value ?? string.Empty).ToString();
            year.Text         = ((excelsheets.Cells[11, 69]).Value ?? string.Empty).ToString();
            textBox22.Text    = ((excelsheets.Cells[5, 152]).Value ?? string.Empty).ToString();
            textBox25.Text    = ((excelsheets.Cells[9, 87]).Value ?? string.Empty).ToString();
            mainDolgnost.Text = ((excelsheets.Cells[151, 36]).Value ?? string.Empty).ToString();
            rashPodpis.Text   = ((excelsheets.Cells[151, 109]).Value ?? string.Empty).ToString();
            rashPodBuh.Text   = ((excelsheets.Cells[154, 62]).Value ?? string.Empty).ToString();
            numDoc            = numberDoc.Text;
            int indexRow = 16;
            int i        = 0;

            while (!(excelsheets.Cells[indexRow, 1].Value ?? string.Empty).Equals(""))
            {
                strginShtatRasps.Add(setDataInString(new StringShtatRasp(), i + 1,
                                                     excelsheets.Cells[indexRow, 1].Value.ToString(), ((excelsheets.Cells[indexRow, 21]).Value ?? string.Empty).ToString(),
                                                     ((excelsheets.Cells[indexRow, 31]).Value ?? string.Empty).ToString(), excelsheets.Cells[indexRow, 64].Value.ToString(),
                                                     Convert.ToDouble((excelsheets.Cells[indexRow, 79]).Value ?? string.Empty), Convert.ToDouble((excelsheets.Cells[indexRow, 94]).Value ?? string.Empty),
                                                     Convert.ToDouble((excelsheets.Cells[indexRow, 105]).Value ?? string.Empty), Convert.ToDouble((excelsheets.Cells[indexRow, 116]).Value ?? string.Empty), ""));

                numerusPeople += Convert.ToInt32(excelsheets.Cells[indexRow, 64].Value.ToString());
                totalInMonth1 += Convert.ToDouble((excelsheets.Cells[indexRow, 79]).Value ?? string.Empty) +
                                 Convert.ToDouble((excelsheets.Cells[indexRow, 94]).Value ?? string.Empty) +
                                 Convert.ToDouble((excelsheets.Cells[indexRow, 105]).Value ?? string.Empty) +
                                 Convert.ToDouble((excelsheets.Cells[indexRow, 116]).Value ?? string.Empty);
                indexRow++;
                i++;
            }
            excelappworkbooks.Close();
            exApp.Quit();
            dataGridView1.DataSource                  = null;
            dataGridView1.DataSource                  = strginShtatRasps;
            dataGridView1.Columns[1].Width            = 150;
            dataGridView1.Columns[2].Width            = 65;
            dataGridView1.Columns[3].Width            = 165;
            dataGridView1.Columns[4].Width            = 72;
            dataGridView1.Columns[5].Width            = 85;
            dataGridView1.Columns[6].Width            = 92;
            dataGridView1.Columns[7].Width            = 92;
            dataGridView1.Columns[8].Width            = 92;
            dataGridView1.Columns[9].Width            = 151;
            dataGridView1.Columns[10].Width           = 90;
            dataGridView1.Columns[11].Visible         = false;
            dataGridView1.Columns["stringId"].Visible = false;

            numerusEd.Text   = numerusPeople.ToString();
            totalEdtx.Text   = numerusPeople.ToString();
            totalInMoth.Text = totalInMonth1.ToString();

            IQueryable <SHTAT_RASP> query = model.SHTAT_RASP;

            countShtat          = query.Count();
            query               = query.Where(rasp => rasp.number == numberDoc.Text);
            countShtatRaspAfter = query.Count();
            if (countShtatRaspAfter != 0)
            {
                foreach (SHTAT_RASP shtat in query)
                {
                    PK_ST = Convert.ToInt32(shtat.PK_SHTAT_RASP);
                }
            }
            form.Close();
            MessageBox.Show("Данные загружены", "", MessageBoxButtons.OK);
        }