Exemplo n.º 1
0
        protected override void ExtraInit()
        {
            base.ExtraInit();
            _tableName     = "ed.EgeCertificate";
            this.MdiParent = null;


            lblIsImported.Visible = false;

            if (_Id == null)
            {
                this.tbNumber.TextChanged += new System.EventHandler(this.tbNumber_TextChanged);
                InitGridNew();
            }

            if (MainClass.IsPasha() || MainClass.IsOwner())
            {
                btnSetStatusPasha.Visible = btnSetStatusPasha.Enabled = true;
                tbCommentFBSPasha.Visible = true;
            }
            else
            {
                btnSetStatusPasha.Visible = btnSetStatusPasha.Enabled = false;
                tbCommentFBSPasha.Visible = false;
            }
        }
Exemplo n.º 2
0
        protected override void  SetAllFieldsEnabled()
        {
            base.SetAllFieldsEnabled();

            this.tbNumber.TextChanged += new System.EventHandler(this.tbNumber_TextChanged);

            tbYear.Enabled       = false;
            tbFBSComment.Enabled = false;
            tbFBSStatus.Enabled  = false;

            tbName.Enabled       = chbNewFIO.Checked;
            tbSecondName.Enabled = chbNewFIO.Checked;
            tbSurname.Enabled    = chbNewFIO.Checked;

            if (MainClass.IsPasha() || MainClass.IsOwner())
            {
                btnSetStatusPasha.Enabled = tbCommentFBSPasha.Enabled = true;
            }
            else
            {
                btnSetStatusPasha.Enabled = false;
            }

            //if (!MainClass.IsPasha())
            //{
            //    SetAllFieldsNotEnabled();
            //    btnSaveChange.Enabled = true;

            //    dgvExams.Enabled = true;
            //    dgvExams.Columns["јпелл¤ци¤"].ReadOnly = true;
            //    dgvExams.Columns["Ѕаллы"].ReadOnly = true;
            //}
        }
Exemplo n.º 3
0
        private void btnCreateAdd_Click(object sender, EventArgs e)
        {
            if (MainClass.IsFacMain() || MainClass.IsOwner() || MainClass.IsPasha())
            {
                using (PriemEntities context = new PriemEntities())
                {
                    int?stBas = null;
                    if (cbExamVed.SelectedItem.ToString().Contains("г/б"))
                    {
                        stBas = 1;
                    }
                    else if (cbExamVed.SelectedItem.ToString().Contains("дог"))
                    {
                        stBas = 2;
                    }

                    extExamsVed ved = (from ev in context.extExamsVed
                                       where ev.Id == ExamVedId
                                       select ev).FirstOrDefault();

                    DateTime passDate = ved.Date;
                    int      examId   = ved.ExamId;

                    SelectExamCrypto frm = new SelectExamCrypto(this, StudyLevelGroupId, FacultyId, stBas, passDate, examId);
                    frm.Show();
                }
            }
        }
Exemplo n.º 4
0
        protected override void ExtraInit()
        {
            base.ExtraInit();
            Dgv.ReadOnly = false;

            using (PriemEntities context = new PriemEntities())
            {
                ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, false);
                ComboServ.FillCombo(cbStudyBasis, HelpClass.GetComboListByTable("ed.StudyBasis", "ORDER BY Name"), false, true);
                cbStudyBasis.SelectedIndex = 0;

                ComboServ.FillCombo(cbStudyForm, HelpClass.GetComboListByTable("ed.StudyForm", "ORDER BY Id"), false, true);
                cbStudyForm.SelectedIndex = 0;

                FillLicenseProgram();

                ComboServ.FillCombo(cbCompetition, HelpClass.GetComboListByTable("ed.Competition"), false, true);

                UpdateDataGrid();

                if (MainClass.IsFacMain() || MainClass.IsOwner())
                {
                    btnLists.Enabled = true;
                }
                else
                {
                    btnLists.Enabled = false;
                }
            }
        }
Exemplo n.º 5
0
        //дополнительная инициализация контролов
        private void InitControls()
        {
            try
            {
                InitFocusHandlers();

                this.CenterToScreen();
                this.MdiParent = MainClass.mainform;
                _bdc           = MainClass.Bdc;
                _drh           = new DataRefreshHandler(UpdateDataGrid);
                MainClass.AddHandler(_drh);

                Dgv = dgvAbitList;

                lblCount.Text = dgvAbitList.RowCount.ToString();
                if (!MainClass.IsOwner())
                {
                    btnRemove.Visible = false;
                }

                using (PriemEntities context = new PriemEntities())
                {
                    ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, true);
                }
            }
            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка при инициализации формы " + exc.Message);
            }
        }
Exemplo n.º 6
0
 //изменение - только для супер
 private void btnMake_Click(object sender, EventArgs e)
 {
     if (MainClass.IsOwner())
     {
         ProtocolCard p = new ProtocolCard(this, FacultyId.Value, StudyBasisId.Value, StudyFormId.Value, ProtocolNumId);
         p.Show();
     }
 }
Exemplo n.º 7
0
 protected override void OpenExistingCard()
 {
     if (MainClass.IsOwner() && ProtocolNumId.HasValue)
     {
         EnableProtocol p = new Priem.EnableProtocol(this, StudyLevelGroupId.Value, FacultyId.Value, StudyBasisId.Value, StudyFormId.Value);
         p.Show();
     }
 }
Exemplo n.º 8
0
        private void btnLock_Click(object sender, EventArgs e)
        {
            if (ExamVedId == null)
            {
                return;
            }

            if (MainClass.IsOwner() || MainClass.IsCrypto() || MainClass.IsPasha())
            {
                if (MessageBox.Show("Ведомость будет закрыта для редактирования, продолжить? ", "Внимание", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    try
                    {
                        using (PriemEntities context = new PriemEntities())
                        {
                            using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew))
                            {
                                List <int> lstNumbers = new List <int>();
                                int        curNum;
                                foreach (DataGridViewRow dgvr in dgvList.Rows)
                                {
                                    Guid persId = new Guid(dgvr.Cells["Id"].Value.ToString());

                                    curNum = GetRandomNumber(ref lstNumbers);
                                    context.ExamsVedHistory_UpdateNumber(ExamVedId, persId, curNum);
                                }

                                context.ExamsVed_UpdateLock(true, ExamVedId);

                                btnChange.Enabled = false;
                                btnDelete.Enabled = false;
                                btnLock.Enabled   = false;
                                lblLocked.Visible = true;
                                MessageBox.Show("Выполнено");

                                btnPrintSticker.Enabled = true;
                                tbCountCell.Enabled     = true;

                                transaction.Complete();
                            }
                        }
                    }

                    catch (Exception ex)
                    {
                        WinFormsServ.Error("Ошибка обновления данных: " + ex.Message);
                    }
                }
            }
            else
            {
                WinFormsServ.Error("Невозможно закрытие ведомостей, недостаточно прав");
            }
        }
 /// <summary>
 /// Статистика - количество заявлений с одного региона пофакультетно
 /// </summary>
 public RegionFacultyAbitCountStatistics()
 {
     InitializeComponent();
     this.MdiParent = MainClass.mainform;
     if (!MainClass.IsOwner() || !MainClass.IsPasha())
     {
         MessageBox.Show("В разработке");
         this.Close();
         return;
     }
     FillComboRegion();
 }
Exemplo n.º 10
0
        protected override void SetAllFieldsNotEnabled()
        {
            base.SetAllFieldsNotEnabled();

            if (MainClass.IsPasha() || MainClass.IsOwner())
            {
                btnSetStatusPasha.Enabled = tbCommentFBSPasha.Enabled = true;
            }
            else
            {
                btnSetStatusPasha.Enabled = false;
            }
        }
Exemplo n.º 11
0
        //дополнительная инициализация контролов
        protected virtual void InitControls()
        {
            InitFocusHandlers();
            drh  = new DataRefreshHandler(UpdateDataGrid);
            prh  = new ProtocolRefreshHandler(UpdateProtocolList);
            prh += new ProtocolRefreshHandler(SelectLastProtocol);
            MainClass.AddHandler(drh);
            MainClass.AddProtocolHandler(prh);

            Dgv = dgvProtocols;

            cbPrint.Items.Clear();

            InitGrid();

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, false);
                    ComboServ.FillCombo(cbStudyBasis, HelpClass.GetComboListByTable("ed.StudyBasis", "ORDER BY Name"), false, false);

                    FillComboStudyForm();
                    UpdateProtocolList();

                    cbFaculty.SelectedIndexChanged     += new EventHandler(cbFaculty_SelectedIndexChanged);
                    cbStudyBasis.SelectedIndexChanged  += new EventHandler(cbStudyBasis_SelectedIndexChanged);
                    cbStudyForm.SelectedIndexChanged   += new EventHandler(cbStudyForm_SelectedIndexChanged);
                    cbProtocolNum.SelectedIndexChanged += new EventHandler(cbProtocolNum_SelectedIndexChanged);
                }

                if (MainClass.RightsSov_SovMain_FacMain())
                {
                    btnCreate.Visible = true;
                }

                // закрываем для создания новых кроме огр набора
                //if (MainClass.HasAddRightsForPriem(FacultyId.Value, null, null, null, StudyFormId.Value, StudyBasisId.Value))
                //    btnCreate.Enabled = true;

                if (MainClass.IsOwner())
                {
                    btnMake.Visible = true;
                }
            }
            catch (Exception ex)
            {
                WinFormsServ.Error("Ошибка при инициализации формы протоколов: " + ex.Message);
            }
        }
Exemplo n.º 12
0
        protected override void ExtraInit()
        {
            this.CenterToParent();
            this.MdiParent = MainClass.mainform;
            _bdc           = MainClass.Bdc;

            _drh = new DataRefreshHandler(UpdateDataGrid);
            MainClass.AddHandler(_drh);

            Dgv.ReadOnly                = true;
            Dgv.AllowUserToAddRows      = Dgv.AllowUserToDeleteRows = false;
            Dgv.CellDoubleClick        += new System.Windows.Forms.DataGridViewCellEventHandler(Dgv_CellDoubleClick);
            Dgv.ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(Dgv_ColumnHeaderMouseClick);

            if (MainClass.IsOwner())
            {
                btnRemove.Visible = true;
            }
            else
            {
                btnRemove.Visible = false;
            }
        }
Exemplo n.º 13
0
        private void btnSetStatusPasha_Click(object sender, EventArgs e)
        {
            if (MainClass.IsPasha() || MainClass.IsOwner())
            {
                if (_Id == null)
                {
                    return;
                }

                using (PriemEntities context = new PriemEntities())
                {
                    var cert = (from ec in context.EgeCertificate
                                where ec.Id == GuidId
                                select ec).FirstOrDefault();

                    if (cert != null)
                    {
                        if (MessageBox.Show(string.Format("ѕроставить статус 'ѕроверено' дл¤ свидетельства {0}?", cert.Number), "¬нимание", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            context.EgeCertificate_UpdateFBSStatus(4, tbCommentFBSPasha.Text.Trim(), cert.Id);
                            MessageBox.Show("¬ыполнено");

                            var c = (from ec in context.EgeCertificate
                                     where ec.Id == GuidId
                                     select ec).FirstOrDefault();

                            FBSStatus  = (from fs in context.FBSStatus where fs.Id == c.FBSStatusId select fs.Name).FirstOrDefault();
                            FBSComment = c.FBSComment;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Ќет свидетельств, удовлетвор¤ющих критери¤м");
                    }
                }
            }
        }
Exemplo n.º 14
0
        //дополнительная инициализация контролов
        private void InitControls()
        {
            InitFocusHandlers();
            bdc = MainClass.Bdc;

            try
            {
                btnDeleteFromVed.Visible = btnDeleteFromVed.Enabled = false;
                btnUnload.Visible        = btnUnload.Enabled = false;

                //наверное нужно писать права по отдельным группам. Чуть больше, зато на порядок понятнее. И чтобы "левых" вставок не было
                //Паше наклейки печатать нельзя??? Непорядок!!!
                if (MainClass.IsFacMain())
                {
                    btnCreate.Visible = true;
                    btnChange.Visible = true;
                    btnDelete.Visible = false;

                    tbCountCell.Visible     = false;
                    lblCountCell.Visible    = false;
                    btnLock.Visible         = false;
                    btnCreateAdd.Visible    = true;
                    btnPrintSticker.Visible = false;
                }
                else if (MainClass.IsCryptoMain() || MainClass.IsPasha())
                {
                    btnCreate.Visible = false;
                    btnChange.Visible = false;
                    btnDelete.Visible = false;

                    tbCountCell.Visible     = true;
                    lblCountCell.Visible    = true;
                    btnLock.Visible         = true;
                    btnCreateAdd.Visible    = true;
                    btnPrintSticker.Visible = true;
                }
                else if (MainClass.IsPasha())
                {
                    btnDelete.Visible        = true;
                    btnChange.Visible        = true;
                    btnDeleteFromVed.Visible = btnDeleteFromVed.Enabled = true;
                    btnUnload.Visible        = btnUnload.Enabled = true;
                }
                else
                {
                    btnCreate.Visible = false;
                    btnChange.Visible = false;
                    btnDelete.Visible = false;

                    tbCountCell.Visible     = false;
                    lblCountCell.Visible    = false;
                    btnLock.Visible         = false;
                    btnCreateAdd.Visible    = false;
                    btnPrintSticker.Visible = false;
                }

                if (MainClass.IsOwner())
                {
                    btnCreate.Visible       = true;
                    btnChange.Visible       = true;
                    btnDelete.Visible       = true;
                    tbCountCell.Visible     = true;
                    lblCountCell.Visible    = true;
                    btnLock.Visible         = true;
                    btnCreateAdd.Visible    = true;
                    btnPrintSticker.Visible = true;
                }

                //по умолчанию печатается 2 штрих-кода
                tbCountCell.Text = (2).ToString();

                using (PriemEntities context = new PriemEntities())
                {
                    ComboServ.FillCombo(cbStudyLevelGroup, HelpClass.GetComboListByTable("ed.StudyLevelGroup", ""), false, false);
                    ComboServ.FillCombo(cbFaculty, HelpClass.GetComboListByTable("ed.qFaculty", "ORDER BY Acronym"), false, false);
                    ComboServ.FillCombo(cbStudyBasis, HelpClass.GetComboListByTable("ed.StudyBasis", "ORDER BY Name"), false, true);

                    UpdateVedList();
                    UpdateDataGrid();

                    cbFaculty.SelectedIndexChanged    += new EventHandler(cbFaculty_SelectedIndexChanged);
                    cbStudyBasis.SelectedIndexChanged += new EventHandler(cbStudyBasis_SelectedIndexChanged);
                    cbExamVed.SelectedIndexChanged    += new EventHandler(cbExamVed_SelectedIndexChanged);
                }
            }
            catch (Exception ex)
            {
                WinFormsServ.Error("Ошибка при инициализации формы ведомостей: " + ex.Message);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// extra information for open - what smi are enabled
        /// </summary>
        /// <param name="path"></param>
        public void OpenHelp(string path)
        {
            try
            {
                bFirstRun = false;
                // убирает все IsOpen для данного пользователя
                MainClass.DeleteAllOpenByHolder();

                tsslMain.Text          = string.Format("Открыта база: Прием в СПбГУ {0} {1}; ", MainClass.sPriemYear, path);
                MainClass.dirTemplates = string.Format(@"{0}\Templates", Application.StartupPath);

                MainClass.InitQueryBuilder();

                ShowProtocolWarning();

                //предупреждение об рабочем режиме базы
                //MessageBox.Show("Уважаемые пользователи!\nСистема находится в рабочем режиме.\nВведение тестовых записей не допускается.", "Внимание");

                if (MainClass.IsOwner())
                {
                    return;
                }

                // магистратура!
                if (MainClass.dbType == PriemType.PriemMag || MainClass.dbType == PriemType.PriemForeigners)
                {
                    smiOlympAbitList.Visible     = false;
                    smiOlymps.Visible            = false;
                    smiOlymp2Competition.Visible = false;
                    smiOlymp2Mark.Visible        = false;
                }
                else
                {
                    smiOnlineChanges.Visible = false;
                    smiLoad.Visible          = false;
                }

                smiRatingList.Visible       = false;
                smiOrderNumbers.Visible     = false;
                smiOlymps.Visible           = false;
                smiCreateVed.Visible        = false;
                smiBooks.Visible            = false;
                smiCrypto.Visible           = false;
                smiFBS.Visible              = false;
                smiExport.Visible           = false;
                smiImport.Visible           = false;
                smiExamsVedRoomList.Visible = false;
                //smiProblemSolver.Visible = false;
                smiEntryView.Visible    = false;
                smiDisEntryView.Visible = false;


                smiEGEStatistics.Visible = false;
                smiDynamics.Visible      = false;
                smiFormA.Visible         = false;
                smiForm2.Visible         = false;

                smiAbitFacultyIntesection.Visible = false;
                smiRegionStat.Visible             = false;
                smiOlympStatistics.Visible        = false;

                // Разделение видимости меню
                if (MainClass.IsFacMain())
                {
                    smiOlymps.Visible                 = true;
                    smiCreateVed.Visible              = true;
                    smiExamsVedRoomList.Visible       = true;
                    smiRatingList.Visible             = true;
                    smiEntryView.Visible              = true;
                    smiDisEntryView.Visible           = true;
                    smiAbitFacultyIntesection.Visible = true;
                    smiExport.Visible                 = true;
                }

                if (MainClass.IsEntryChanger())
                {
                    smiBooks.Visible           = true;
                    smiEnterManual.Visible     = false;
                    smiRatingListPasha.Visible = false;
                    smiRatingList.Visible      = true;
                    smiExport.Visible          = true;
                }

                if (MainClass.IsPasha())
                {
                    smiCrypto.Visible       = true;
                    smiBooks.Visible        = true;
                    smiRatingList.Visible   = true;
                    smiFBS.Visible          = true;
                    smiOrderNumbers.Visible = true;
                    smiExport.Visible       = true;
                    smiEntryView.Visible    = true;
                    smiDisEntryView.Visible = true;
                    smiEnterManual.Visible  = true;
                    smiAppeal.Visible       = true;
                    smiDecryptor.Visible    = true;

                    //Паша попросил добавить себе
                    smiCreateVed.Visible        = true;
                    smiExamsVedRoomList.Visible = true;

                    smiRatingListPasha.Visible = true;

                    smiEGEStatistics.Visible = true;
                    smiDynamics.Visible      = true;
                    smiFormA.Visible         = true;
                    smiForm2.Visible         = true;

                    smiAbitFacultyIntesection.Visible = true;
                    smiRegionStat.Visible             = true;
                    smiOlympStatistics.Visible        = true;
                }

                if (MainClass.IsRectorat())
                {
                    smiEGEStatistics.Visible = true;
                    smiFormA.Visible         = true;

                    smiExport.Visible = true;

                    smiAbitFacultyIntesection.Visible = true;
                    smiRegionStat.Visible             = true;
                    smiOlympStatistics.Visible        = true;
                }

                if (MainClass.IsSovetnik() || MainClass.IsSovetnikMain())
                {
                    smiAbitFacultyIntesection.Visible = true;
                }

                if (MainClass.IsCrypto())
                {
                    smiCrypto.Visible           = true;
                    smiExamsVedRoomList.Visible = true;
                    smiAppeal.Visible           = false;
                    smiDecryptor.Visible        = false;
                    smiLoadMarks.Visible        = false;
                }

                if (MainClass.IsCryptoMain())
                {
                    smiCrypto.Visible           = true;
                    smiAppeal.Visible           = true;
                    smiExamsVedRoomList.Visible = true;

                    //глава шифровалки тоже хочет создавать ведомости
                    smiCreateVed.Visible = true;

                    smiDecryptor.Visible = false;
                    smiLoadMarks.Visible = false;
                }

                if (MainClass.IsPrintOrder())
                {
                    smiEntryView.Visible = true;
                }

                //временно
                smiImport.Visible = false;


                Form frm;
                if (MainClass._config.ValuesList.Keys.Contains("lstAbitDef"))
                {
                    bool lstAbitDef = bool.Parse(MainClass._config.ValuesList["lstAbitDef"]);

                    if (lstAbitDef)
                    {
                        frm = new ListAbit(this);
                        smiListAbit.Checked   = true;
                        smiListPerson.Checked = false;
                    }
                    else
                    {
                        if (MainClass.dbType == PriemType.PriemMag)
                        {
                            frm = new ApplicationInetList();
                        }
                        else
                        {
                            frm = new PersonInetList();
                        }

                        smiListPerson.Checked = true;
                        smiListAbit.Checked   = false;
                    }
                }
                else
                {
                    frm = new PersonInetList();
                }

                ShowProtocolWarning();

                frm.Show();
            }

            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка инициализации " + exc.Message);
            }
        }
Exemplo n.º 16
0
        private void btnPrintSticker_Click(object sender, EventArgs e)
        {
            if (ExamVedId == null)
            {
                return;
            }

            if (MainClass.IsOwner() || MainClass.IsCrypto() || MainClass.IsPasha() || MainClass.IsCryptoMain())
            {
                FileStream fileS    = null;
                string     savePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Sticker.pdf";

                float fontsize = 8;

                try
                {
                    using (PriemEntities context = new PriemEntities())
                    {
                        Document document = new Document(PageSize.A4, 50, 50, 50, 50);
                        document.SetMargins(18, 18, 36, 5);

                        using (fileS = new FileStream(savePath, FileMode.Create))
                        {
                            BaseFont             bfTimes = BaseFont.CreateFont(string.Format(@"{0}\times.ttf", MainClass.dirTemplates), BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
                            iTextSharp.text.Font font    = new iTextSharp.text.Font(bfTimes, 10);

                            PdfWriter pw = PdfWriter.GetInstance(document, fileS);
                            document.Open();

                            int cntCells = 2;
                            int.TryParse(tbCountCell.Text.Trim(), out cntCells);

                            string examId;
                            string examName;
                            string examDate;
                            string facId;
                            string vedNumber;

                            extExamsVed ved = (from ev in context.extExamsVed
                                               where ev.Id == ExamVedId
                                               select ev).FirstOrDefault();

                            examId    = ved.ExamId.ToString();
                            examName  = ved.ExamName.ToString();
                            examDate  = ved.Date.ToShortDateString();
                            vedNumber = ved.Number.ToString();
                            facId     = FacultyId.ToString();

                            DataSet dsPersons = bdc.GetDataSet(string.Format("SELECT DISTINCT ed.extPerson.Id, ed.extPerson.PersonNum as RegNum, ed.extPerson.FIO, ed.ExamsVedHistory.PersonVedNumber " +
                                                                             "FROM ed.extPerson LEFT JOIN ed.ExamsVedHistory ON ed.ExamsVedHistory.PersonId = ed.extPerson.Id WHERE ed.ExamsVedHistory.ExamsVedId = '{0}' ORDER BY FIO ", ExamVedId.ToString()));

                            PdfPTable t            = new PdfPTable(3);
                            float     pgW          = (PageSize.A4.Width - 36) / 3;
                            float[]   headerwidths = { pgW, pgW, pgW };
                            t.SetWidths(headerwidths);
                            t.WidthPercentage           = 100f;
                            t.SpacingBefore             = 10f;
                            t.SpacingAfter              = 10f;
                            t.DefaultCell.MinimumHeight = 120;

                            int cellsNum = (dsPersons.Tables[0].Rows.Count) * (cntCells + 1);
                            int ost      = cellsNum % 3;

                            foreach (DataRow drr in dsPersons.Tables[0].Rows)
                            {
                                string text = drr["FIO"].ToString() + "\n" + drr["RegNum"].ToString() + " " + facId + "\n";
                                text += examDate + " " + examName;

                                Barcode128 barcode1 = new Barcode128();
                                barcode1.Code = vedNumber + "==" + drr["PersonVedNumber"].ToString() + "-";

                                Barcode128 barcode2 = new Barcode128();
                                barcode2.Code = vedNumber + "==" + drr["PersonVedNumber"].ToString() + "-";

                                PdfContentByte        cb   = pw.DirectContent;
                                iTextSharp.text.Image img1 = barcode1.CreateImageWithBarcode(cb, null, null);
                                img1.ScaleAbsolute(80f, 60f);

                                iTextSharp.text.Image img2 = barcode2.CreateImageWithBarcode(cb, iTextSharp.text.Color.BLACK, iTextSharp.text.Color.WHITE);
                                img2.ScaleAbsolute(80f, 60f);


                                PdfPTable ptPl = new PdfPTable(1);
                                float[]   hwh  = { pgW };
                                ptPl.SetWidthPercentage(hwh, PageSize.A4);

                                PdfPCell clPlText = new PdfPCell(new Phrase(text, new iTextSharp.text.Font(bfTimes, fontsize)));
                                clPlText.HorizontalAlignment = iTextSharp.text.Rectangle.ALIGN_CENTER;
                                clPlText.PaddingBottom       = 2;
                                clPlText.PaddingTop          = 2;
                                clPlText.Border = iTextSharp.text.Rectangle.NO_BORDER;

                                PdfPCell clPlBarc = new PdfPCell();
                                clPlBarc.AddElement(img1);
                                clPlBarc.HorizontalAlignment = iTextSharp.text.Rectangle.ALIGN_CENTER;
                                clPlBarc.PaddingTop          = 1;
                                clPlBarc.PaddingLeft         = 40;
                                clPlBarc.Border = iTextSharp.text.Rectangle.NO_BORDER;

                                ptPl.AddCell(clPlText);
                                ptPl.AddCell(clPlBarc);

                                PdfPCell pcell = new PdfPCell(ptPl);
                                pcell.PaddingTop    = 6;
                                pcell.PaddingBottom = 6;
                                pcell.PaddingLeft   = 6;
                                pcell.PaddingRight  = 6;
                                pcell.FixedHeight   = 100;
                                pcell.Border        = iTextSharp.text.Rectangle.NO_BORDER;

                                t.AddCell(pcell);

                                PdfPCell pcell1;
                                for (int i = 0; i < cntCells; i++)
                                {
                                    ptPl = new PdfPTable(1);
                                    ptPl.SetWidthPercentage(hwh, PageSize.A4);

                                    clPlText = new PdfPCell();
                                    clPlText.AddElement(img2);
                                    clPlText.PaddingLeft  = 40;
                                    clPlText.PaddingRight = 40;
                                    clPlText.PaddingTop   = 20;
                                    clPlText.Border       = iTextSharp.text.Rectangle.NO_BORDER;

                                    clPlBarc = new PdfPCell(new Phrase((i + 1).ToString(), new iTextSharp.text.Font(bfTimes, fontsize)));
                                    clPlBarc.HorizontalAlignment = iTextSharp.text.Rectangle.ALIGN_CENTER;
                                    clPlBarc.PaddingTop          = 1;
                                    clPlBarc.Border = iTextSharp.text.Rectangle.NO_BORDER;

                                    ptPl.AddCell(clPlText);
                                    ptPl.AddCell(clPlBarc);

                                    pcell1             = new PdfPCell(ptPl);
                                    pcell1.FixedHeight = 100;
                                    pcell1.Border      = iTextSharp.text.Rectangle.NO_BORDER;
                                    t.AddCell(pcell1);
                                }
                            }

                            for (int i = 0; i < 3 - ost; i++)
                            {
                                PdfPCell pc = new PdfPCell();
                                pc.Border = iTextSharp.text.Rectangle.NO_BORDER;
                                t.AddCell(pc);
                            }

                            if (t != null)
                            {
                                document.Add(t);
                            }

                            document.Close();

                            Process pr = new Process();

                            pr.StartInfo.Verb     = "Print";
                            pr.StartInfo.FileName = string.Format(savePath);
                            pr.Start();

                            pr.Close();
                        }
                    }
                }

                catch (Exception exc)
                {
                    WinFormsServ.Error(exc.Message);
                }
                finally
                {
                    if (fileS != null)
                    {
                        fileS.Dispose();
                    }
                }
            }

            else
            {
                WinFormsServ.Error("Невозможно создание наклеек, недостаточно прав");
            }
        }
Exemplo n.º 17
0
        private bool SaveMarks()
        {
            if (!MainClass.IsPasha() && !MainClass.IsOwner())
            {
                return(false);
            }

            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew))
                    {
                        string mark = null;

                        for (int i = 0; i < dgvMarks.Rows.Count; i++)
                        {
                            Guid abId = new Guid(dgvMarks["abitId", i].Value.ToString());

                            Guid?entryId = (from ab in context.extAbit
                                            where ab.Id == abId
                                            select ab.EntryId).FirstOrDefault();

                            int examInEntryId = (from ex in context.extExamInEntry
                                                 where ex.ExamId == _examId && ex.EntryId == entryId
                                                 select ex.Id).FirstOrDefault();

                            if (dgvMarks["Баллы", i].Value != null)
                            {
                                mark = dgvMarks["Баллы", i].Value.ToString().Trim();
                            }

                            if (!string.IsNullOrEmpty(mark))
                            {
                                int mrk;
                                if (int.TryParse(mark, out mrk) && mrk >= 0 && mrk < 101)
                                {
                                    context.Mark_Insert(abId, examInEntryId, mrk, DateTime.Now, false, false, true, null, null, null);
                                }
                                else
                                {
                                    dgvMarks.CurrentCell = dgvMarks["Баллы", i];
                                    WinFormsServ.Error(dgvMarks["ФИО", i].Value.ToString() + ": неправильно введены данные");
                                    return(false);
                                }
                            }
                        }

                        transaction.Complete();
                    }

                    return(true);
                }
            }

            catch (Exception exc)
            {
                WinFormsServ.Error("Ошибка сохранения данных: \n" + exc.Message);
                return(false);
            }
        }