示例#1
0
        private void initData(decimal id)
        {
            Model1 model = new Model1();
            var    card  = model.PERSONCARD.First(c => c.PK_PERSONCARD == id);

            if (card == null)
            {
                return;
            }

            textBox_name.Text        = card.NAME;
            textBox_secondName.Text  = card.SURNAME;
            textBox_otch.Text        = card.MIDDLENAME;
            textBox_telephone.Text   = card.MOBTEL;
            textBox_telephone2.Text  = card.DOPTEL;
            textBox_tabelNumber.Text = card.TABEL_NUM.ToString();
            textBox_dolzhnost.Text   = card.JOB_POSITION.NAME;
            textBox_struct.Text      = card.TABEL.PODRAZDELORG.NAME;
            comboBox_gender.Text     = card.GENDER.NAME;

            comboBox_grazdan.Text         = card.GRAZDAN.NAME;
            textBox_passportSerial.Text   = card.SERPASSPORT;
            textBox_passportNumber.Text   = card.NUMPASSPORT;
            richTextBox_vidan.Text        = card.PLACE_VIDACHI_PASSPORT;
            dateTimePicker_dateVidan.Text = card.PASSPORTGETDATE.ToString();

            dateTimePicker_birthday.Text   = card.BIRTHDATE.ToString();
            richTextBox_birthdayPlace.Text = card.PLACEBIRTH;

            textBox_inn.Text    = card.INN;
            textBox_strah.Text  = card.SNILS;
            comboBobx_brak.Text = card.MARTIAL_STATUS.NAME;

            dataGridView_family.Rows.Clear();
            foreach (var member in card.FAMILY_MEMBER)
            {
                dataGridView_family.Rows.Add(member.SURNAME + " " + member.NAME + " " + member.MIDDLENAME,
                                             member.BIRTHYEAR);
            }

            foreach (var lang in card.UNION_LANGUAGE_PERSONCARD)
            {
                dataGridView_languages.Rows.Add(lang.LANGUAGE.NAME, lang.LANGUAGE_LVL.NAME);
            }

            comboBox_profession.Text = card.PROFESSION.NAME;

            dataGridView_education.Rows.Clear();
            foreach (var edu in card.ONE_EDU)
            {
                dataGridView_education.Rows.Add(
                    edu.NUMDOC,
                    edu.TYPE_EDU.NAME,
                    edu.PLACE_EDU.NAME,
                    edu.SPECIALTY.NAME,
                    edu.ENDDATE
                    );
            }

            textBox_doljnost2.Text     = card.JOB_POSITION.NAME;
            textBox_structOtdel.Text   = card.TABEL.PODRAZDELORG.NAME;
            textBox_workType.Text      = card.TYPE_WORK.NAME;
            textBox_workCharacter.Text = card.CHARACTER_WORK.NAME;

            dataGridView_job.Rows.Clear();
            foreach (var perevod in card.PEREVOD)
            {
                dataGridView_job.Rows.Add(
                    perevod.STARTWORKDATE,
                    perevod.ENDWORKDATE,
                    perevod.PODRAZDELORG.NAME,
                    perevod.JOB_POSITION.NAME,
                    perevod.JOB_POSITION1.STR_SHTAT_RASP.First().TARIFF,
                    perevod.PERSONCARD.CHARACTER_WORK.NAME,
                    perevod.JOB_POSITION1,
                    perevod.REASON
                    );
            }

            showKomandirovki(card);

            richTextBox_dopSved.Text = card.DOPINFO;

            textBox_dateUval.Text = card.UVALDATE.ToString();
            try
            {
                textBox_uvalWorkerJob.Text = card.UVAL.First().JOB_POSITION.NAME;
                //todo фио уволившего найти хз где
                textBox_orderNumber.Text = card.UVAL.First().NUMWORKDOGOVOR;
                textBox_orderDate.Text   = card.UVAL.First().ENDWORKDOGOVORDATE.ToString();
            }
            catch (Exception e)
            {
                // значит там наверное пусто и нам все равно
            }
        }
示例#2
0
        private void find()
        {
            Model1 model1    = new Model1();
            var    resultSet = model1.PERSONCARD.Where(personcard => true);

            if (checkBox_nameQuery.Checked)
            {
                switch (comboBox_nameCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.NAME == textBox_nameValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.NAME != textBox_nameValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.NAME, textBox_nameValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.NAME, textBox_nameValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.NAME, textBox_nameValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.NAME, textBox_nameValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *  compare(card.NAME, comboBox_nameCmp.Text, textBox_nameValue.Text));*/
            }

            if (checkBox_secondNameQuery.Checked)
            {
                switch (comboBox_secondNameCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.SURNAME == textBox_secondNameValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.SURNAME != textBox_secondNameValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.SURNAME, textBox_secondNameValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.SURNAME, textBox_secondNameValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.SURNAME, textBox_secondNameValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.SURNAME, textBox_secondNameValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *  compare(card.SURNAME, comboBox_secondNameCmp.Text, textBox_secondNameValue.Text));*/
            }

            if (checkBox_middleNameQuery.Checked)
            {
                switch (comboBox_middleNameCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.MIDDLENAME == textBox_middleNameValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.MIDDLENAME != textBox_middleNameValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MIDDLENAME, textBox_middleNameValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MIDDLENAME, textBox_middleNameValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MIDDLENAME, textBox_middleNameValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MIDDLENAME, textBox_middleNameValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *  compare(card.MIDDLENAME, comboBox_middleNameCmp.Text, textBox_middleNameValue.Text));*/
            }

            if (checkBox_genderQuery.Checked)
            {
                switch (comboBox_genderCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.GENDER.NAME == comboBox_genderValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.GENDER.NAME != comboBox_genderValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.GENDER.NAME, comboBox_genderValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.GENDER.NAME, comboBox_genderValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.GENDER.NAME, comboBox_genderValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.GENDER.NAME, comboBox_genderValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *  compare(card.GENDER.NAME, comboBox_genderCmp.Text, comboBox_genderValue.Text));*/
            }

            if (checkBox_grazdanQuery.Checked)
            {
                switch (comboBox_grazdanCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.GRAZDAN.NAME == textBox_grazdanValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.GRAZDAN.NAME != textBox_grazdanValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.GRAZDAN.NAME, textBox_grazdanValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.GRAZDAN.NAME, textBox_grazdanValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.GRAZDAN.NAME, textBox_grazdanValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.GRAZDAN.NAME, textBox_grazdanValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(card.GRAZDAN.NAME, comboBox_grazdanCmp.Text, textBox_grazdanValue.Text));*/
            }

            if (checkBox_mobtelQuery.Checked)
            {
                switch (comboBox_mobtelCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.MOBTEL == textBox_mobtelValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.MOBTEL != textBox_mobtelValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MOBTEL, textBox_mobtelValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MOBTEL, textBox_mobtelValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MOBTEL, textBox_mobtelValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MOBTEL, textBox_mobtelValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(card.MOBTEL, comboBox_mobtelCmp.Text, textBox_mobtelValue.Text));*/
            }

            if (checkBox_professionQuery.Checked)
            {
                switch (comboBox_professionCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.PROFESSION.NAME == textBox_professionValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.PROFESSION.NAME != textBox_professionValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.PROFESSION.NAME, textBox_professionValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.PROFESSION.NAME, textBox_professionValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.PROFESSION.NAME, textBox_professionValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.PROFESSION.NAME, textBox_professionValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(card.PROFESSION.NAME, comboBox_professionCmp.Text, textBox_professionValue.Text));*/
            }

            if (checkBox_innQuery.Checked)
            {
                switch (comboBox_innCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.INN == textBox_innValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.INN != textBox_innValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.INN, textBox_innValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.INN, textBox_innValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.INN, textBox_innValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.INN, textBox_innValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(card.INN, comboBox_innCmp.Text, textBox_innValue.Text));*/
            }

            if (checkBox_snilsQuery.Checked)
            {
                switch (comboBox_snilsCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.SNILS == textBox_snilsValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.SNILS != textBox_snilsValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.SNILS, textBox_snilsValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.SNILS, textBox_snilsValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.SNILS, textBox_snilsValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.SNILS, textBox_snilsValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(card.SNILS, comboBox_snilsCmp.Text, textBox_snilsValue.Text));*/
            }

            if (checkBox_maritalQuery.Checked)
            {
                switch (comboBox_maritalCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.MARTIAL_STATUS.NAME == comboBox_maritalValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.MARTIAL_STATUS.NAME != comboBox_maritalValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MARTIAL_STATUS.NAME, comboBox_maritalValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MARTIAL_STATUS.NAME, comboBox_maritalValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MARTIAL_STATUS.NAME, comboBox_maritalValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.MARTIAL_STATUS.NAME, comboBox_maritalValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(card.MARTIAL_STATUS.NAME, comboBox_maritalCmp.Text, comboBox_maritalValue.Text));*/
            }

            if (checkBox_tabelnumQuery.Checked)
            {
                Decimal tabelNumVal = Convert.ToDecimal(textBox_tabelnumValue.Text);
                switch (comboBox_tabelnumCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.TABEL_NUM == tabelNumVal);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.TABEL_NUM != tabelNumVal);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                card.TABEL_NUM > tabelNumVal);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                card.TABEL_NUM >= tabelNumVal);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                card.TABEL_NUM < tabelNumVal);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                card.TABEL_NUM <= tabelNumVal);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(SqlFunctions.StringConvert(card.TABEL_NUM.Value), comboBox_tabelnumCmp.Text, textBox_tabelnumValue.Text));*/
            }

            if (checkBox_uvalQuery.Checked)
            {
                switch (comboBox_uvalCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.REASON_UVAL == textBox_uvalValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.REASON_UVAL != textBox_uvalValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.REASON_UVAL, textBox_uvalValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.REASON_UVAL, textBox_uvalValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.REASON_UVAL, textBox_uvalValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.REASON_UVAL, textBox_uvalValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(card.REASON_UVAL, comboBox_uvalCmp.Text, textBox_uvalValue.Text));*/
            }

            if (checkBox_typeworkQuery.Checked)
            {
                switch (comboBox_typeworkCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.TYPE_WORK.NAME == comboBox_typeworkValue.Text);
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.TYPE_WORK.NAME != comboBox_typeworkValue.Text);
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.TYPE_WORK.NAME, comboBox_typeworkValue.Text, StringComparison.Ordinal) > 0);
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.TYPE_WORK.NAME, comboBox_typeworkValue.Text, StringComparison.Ordinal) >= 0);
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.TYPE_WORK.NAME, comboBox_typeworkValue.Text, StringComparison.Ordinal) < 0);
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                String.Compare(card.TYPE_WORK.NAME, comboBox_typeworkValue.Text, StringComparison.Ordinal) <= 0);
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(card.TYPE_WORK.NAME, comboBox_typeworkCmp.Text, comboBox_typeworkValue.Text));*/
            }

            if (checkBox_birthQuery.Checked)
            {
                switch (comboBox_birthCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.BIRTHDATE == DbFunctions.TruncateTime(dateTimePicker_birthValue.Value));
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.BIRTHDATE != DbFunctions.TruncateTime(dateTimePicker_birthValue.Value));
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                card.BIRTHDATE > DbFunctions.TruncateTime(dateTimePicker_birthValue.Value));
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                card.BIRTHDATE >= DbFunctions.TruncateTime(dateTimePicker_birthValue.Value));
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                card.BIRTHDATE < DbFunctions.TruncateTime(dateTimePicker_birthValue.Value));
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                card.BIRTHDATE <= DbFunctions.TruncateTime(dateTimePicker_birthValue.Value));
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(card.BIRTHDATE, comboBox_birthCmp.Text, DbFunctions.TruncateTime(Convert.ToDateTime(textBox_birthValue.Text))););*/
            }

            if (checkBox_eduQuery.Checked)
            {
                switch (comboBox_eduCmp.Text)
                {
                case "=":
                    resultSet = resultSet.Where(card =>
                                                card.ONE_EDU.Any(edu => edu.PLACE_EDU.NAME == comboBox_eduValue.Text));
                    break;

                case "!=":
                    resultSet = resultSet.Where(card =>
                                                card.ONE_EDU.Any(edu => edu.PLACE_EDU.NAME != comboBox_eduValue.Text));
                    break;

                case ">":
                    resultSet = resultSet.Where(card =>
                                                card.ONE_EDU.Any(edu => String.Compare(edu.PLACE_EDU.NAME, comboBox_eduValue.Text, StringComparison.Ordinal) > 0));
                    break;

                case ">=":
                    resultSet = resultSet.Where(card =>
                                                card.ONE_EDU.Any(edu => String.Compare(edu.PLACE_EDU.NAME, comboBox_eduValue.Text, StringComparison.Ordinal) >= 0));
                    break;

                case "<":
                    resultSet = resultSet.Where(card =>
                                                card.ONE_EDU.Any(edu => String.Compare(edu.PLACE_EDU.NAME, comboBox_eduValue.Text, StringComparison.Ordinal) < 0));
                    break;

                case "<=":
                    resultSet = resultSet.Where(card =>
                                                card.ONE_EDU.Any(edu => String.Compare(edu.PLACE_EDU.NAME, comboBox_eduValue.Text, StringComparison.Ordinal) <= 0));
                    break;
                }

                /*resultSet = resultSet.Where(card =>
                 *      compare(card., comboBox_eduCmp.Text, comboBox_eduValue.Text));*/
            }

            if (textBox_innValue.TextLength != 12 && textBox_innValue.TextLength != 0)
            {
                MessageBox.Show("ИНН должен содержать ровно 12 цифр!");
                textBox_innValue.Focus();
                return;
            }

            if (textBox_snilsValue.TextLength != 11 && textBox_snilsValue.TextLength != 0)
            {
                MessageBox.Show("СНИЛС должен содержать ровно 11 цифр!");
                textBox_snilsValue.Focus();
                return;
            }

            printResult(resultSet);
        }
示例#3
0
        private void saveData()
        {
            try
            {
                Model1     model = new Model1();
                PERSONCARD personcard;
                if (id != -1)
                {
                    personcard = model.PERSONCARD.First(x => x.PK_PERSONCARD == id);
                }
                else
                {
                    personcard = new PERSONCARD();
                }

                personcard.NAME       = textBox_name.Text;
                personcard.SURNAME    = textBox_secondName.Text;
                personcard.ALPHABET   = personcard.SURNAME[0].ToString();
                personcard.MIDDLENAME = textBox_otch.Text;
                personcard.MOBTEL     = textBox_telephone.Text;
                personcard.DOPTEL     = textBox_telephone2.Text;

                personcard.DATECREATE = DateTime.Now;

                personcard.GENDER = model.GENDER.First(g => g.NAME == comboBox_gender.Text);

                personcard.GRAZDAN = model.GRAZDAN.First(g => g.NAME == comboBox_grazdan.Text);

                personcard.SERPASSPORT            = textBox_passportSerial.Text;
                personcard.NUMPASSPORT            = textBox_passportNumber.Text;
                personcard.PLACE_VIDACHI_PASSPORT = richTextBox_vidan.Text;
                personcard.PASSPORTGETDATE        = Convert.ToDateTime(dateTimePicker_dateVidan.Text);

                personcard.BIRTHDATE  = Convert.ToDateTime(dateTimePicker_birthday.Text);
                personcard.PLACEBIRTH = richTextBox_birthdayPlace.Text;

                personcard.PLACELIVE     = richTextBox_livingPlace.Text;
                personcard.PLACEREGISTER = richTextBox_livingPlaceFact.Text;

                personcard.INN   = textBox_inn.Text;
                personcard.SNILS = textBox_strah.Text;

                personcard.MARTIAL_STATUS = model.MARTIAL_STATUS.First(m => m.NAME == comboBobx_brak.Text);

                if (comboBox_profession.Text != "")
                {
                    personcard.PROFESSION = model.PROFESSION.First(p => p.NAME == comboBox_profession.Text);
                }

                saveFamily(personcard, model);
                saveEducation(personcard, model);
                saveLanguage(personcard, model);

                try
                {
                    if (id == -1)
                    {
                        personcard.PK_PERSONCARD = model.PERSONCARD.Max(p => p.PK_PERSONCARD) + 1;
                        model.PERSONCARD.Add(personcard);
                    }

                    personcard.TABEL_NUM = personcard.PK_PERSONCARD;
                    model.SaveChanges();
                    id = Convert.ToInt64(personcard.PK_PERSONCARD);
                    button3.Enabled          = true;
                    textBox_tabelNumber.Text = personcard.TABEL_NUM.ToString();
                }
                catch (Exception e)
                {
                    DialogResult dialog = MessageBox.Show(
                        "Непредвиденная ошибка при сохранении личной карточки " + e.ToString(), "Ошибка",
                        MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                }
            }
            catch (Exception e)
            {
                DialogResult dialog = MessageBox.Show(
                    "Ошибка при заполнении данных", "Ошибка",
                    MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            }
        }
示例#4
0
        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView_family.Rows.Clear();
            _list.Clear();
            string firstname = this.firstname.Text;
            string fullname  = this.fullname.Text;
            string otchestvo = this.otchestvo.Text;
            Model1 model     = new Model1();
            IQueryable <PRIKAZ> selectMens = model.PRIKAZ;

            if (firstname != "")
            {
                selectMens = selectMens.Where
                                 (men => men.PERSONCARD.NAME == firstname);
            }
            if (fullname != "")
            {
                selectMens = selectMens.Where
                                 (men => men.PERSONCARD.SURNAME == fullname);
            }
            if (otchestvo != "")
            {
                selectMens = selectMens.Where
                                 (men => men.PERSONCARD.MIDDLENAME == otchestvo);
            }
            string isProjectt = "0";

            if (checkBox_Confirm.Checked == true)
            {
                isProjectt = "1";
            }
            selectMens = selectMens.Where
                             (men => men.ISPROJECT == isProjectt);
            DateTime dateOt = new DateTime(dateTimePickerOt.Value.Year,
                                           dateTimePickerOt.Value.Month,
                                           dateTimePickerOt.Value.Day, 0, 0, 0, 0);
            DateTime dateDo = dateTimePickerDo.Value;

            selectMens = selectMens.Where(men =>
                                          men.CREATEDATE.Value.CompareTo(dateOt) >= 0 &&
                                          men.CREATEDATE.Value.CompareTo(dateDo) <= 0);

            selectMens.FirstOrDefault();
            if (selectMens == null)
            {
                return;
            }

            selectMens.ToArray();
            foreach (var item in selectMens)
            {
                bool isProject = false;
                if (item.ISPROJECT == "1")
                {
                    isProject = true;
                }
                if ((checkBoxPriem.Checked && item.PK_TYPE_PRIKAZ == 1) ||
                    (checkBoxKomand.Checked && item.PK_TYPE_PRIKAZ == 2) ||
                    (checkBoxDelWork.Checked && item.PK_TYPE_PRIKAZ == 3) ||
                    (checkBoxPerevod.Checked && item.PK_TYPE_PRIKAZ == 4))
                {
                    dataGridView_family.Rows.Add(item.PERSONCARD.SURNAME + " " + item.PERSONCARD.NAME + " " + item.PERSONCARD.MIDDLENAME,
                                                 item.CREATEDATE, item.TYPE_PRIKAZ.NAME, isProject);
                    _list.Add(item.PK_PRIKAZ);
                }
            }
        }