Ejemplo n.º 1
0
        //проверка данных
        protected virtual bool CheckData()
        {
            int    iProtocolTypeId = ProtocolList.TypeToInt(_type);
            string sNum            = ProtocolName;
            //проверяем, есть ли в базе такое же значение
            string s = string.Format("SELECT id FROM ed.qProtocol {0}  AND ProtocolTypeId = {1} AND Number = '{2}'", GetWhereClause("ed.qProtocol"), iProtocolTypeId, sNum);

            if (!isNew)
            {
                s += string.Format(" AND IsOld=0 AND Id<>'{0}'", _id);
            }

            string sCheck = MainClass.Bdc.GetStringValue(s);

            if (sNum.Length == 0)
            {
                epError.SetError(tbNum, "Пустое или повторяющееся значение.");
                return(false);
            }
            else if (sCheck.Length > 0)
            {
                epError.SetError(tbNum, "Протокол с данным номером уже существует");
                return(false);
            }
            else
            {
                epError.Clear();
            }

            return(true);
        }
Ejemplo n.º 2
0
        public static void OpenNewProtocol(ProtocolList formOwner, int iFacultyId, int iStudyFormId, int iStudyBasisId, ProtocolTypes _pType)
        {
            foreach (Form frmChild in mainform.MdiChildren)
            {
                if (frmChild is ProtocolCard)
                {
                    //фокус на не закрытый протокол
                    frmChild.Focus();
                    return;
                }
            }

            ProtocolCard p;

            switch (_pType)
            {
            case ProtocolTypes.EnableProtocol: { p = new EnableProtocol(formOwner, iFacultyId, iStudyBasisId, iStudyFormId); break; }

            case ProtocolTypes.DisEnableProtocol: { p = new DisEnableProtocol(formOwner, iFacultyId, iStudyBasisId, iStudyFormId); break; }

            case ProtocolTypes.ChangeCompCelProtocol: { p = new ChangeCompCelProtocol(formOwner, iFacultyId, iStudyBasisId, iStudyFormId); break; }

            case ProtocolTypes.ChangeCompBEProtocol: { p = new ChangeCompBEProtocol(formOwner, iFacultyId, iStudyBasisId, iStudyFormId); break; }

            default: { p = new EnableProtocol(formOwner, iFacultyId, iStudyBasisId, iStudyFormId); break; }
            }

            p.Show();
        }
Ejemplo n.º 3
0
        //конструктор
        public ProtocolCard(ProtocolList owner, int studyLevelGroupId, int facultyId, int studyBasisId, int studyFormId, int?licenseProgramId, bool isSecond, bool isReduced, bool isParallel, bool isListener, bool isCel, Guid?id)
        {
            InitializeComponent();

            _facultyId         = facultyId;
            _studyLevelGroupId = studyLevelGroupId;
            _licenseProgramId  = licenseProgramId;
            _studyBasisId      = studyBasisId;
            _studyFormId       = studyFormId;
            _id    = id;
            _Owner = owner;

            _isSecond   = isSecond;
            _isReduced  = isReduced;
            _isParallel = isParallel;
            _isListener = isListener;
            _isCel      = isCel;
            _isForeign  = (MainClass.dbType == PriemType.PriemForeigners);

            //флаг, если новый
            isNew             = id.HasValue ? false : true;
            chbInostr.Visible = false;

            InitControls();
        }
Ejemplo n.º 4
0
        //сохранение
        protected override bool Save()
        {
            //проверка данных
            if (!CheckData())
            {
                return(false);
            }

            /*
             * int total = GetTotalCount();
             *
             * int selected = 0;
             *
             * foreach (List<string> lst in lstSelected)
             *  selected += lst.Count;
             *
             * if (selected != total)
             * {
             *  MessageBox.Show("Выберите формулировку для всех абитуриентов, имеющих право на зачисления, из зеленый зоны волны!", "Внимание");
             *  return false;
             * }
             */
            try
            {
                using (PriemEntities context = new PriemEntities())
                {
                    using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew))
                    {
                        Guid protocolId;

                        ObjectParameter paramId         = new ObjectParameter("id", typeof(Guid));
                        int             iProtocolTypeId = ProtocolList.TypeToInt(_type);

                        context.Protocol_InsertAll(_studyLevelGroupId,
                                                   _facultyId, _licenseProgramId, _studyFormId, _studyBasisId, tbNum.Text, dtpDate.Value, iProtocolTypeId,
                                                   string.Empty, !isNew, null, _isSecond, _isReduced, _isParallel, _isListener, MainClass.dbType == PriemType.PriemForeigners, paramId);

                        protocolId = (Guid)paramId.Value;

                        foreach (int?key in lstSelected.Keys)
                        //for (int i=0; i<lstSelected.Count; i++)
                        {
                            List <string> lst = lstSelected[key];
                            foreach (string str in lst)
                            {
                                Guid abId = new Guid(str.Trim(new char[] { '\'' }));
                                context.ProtocolHistory_Insert(abId, protocolId, false, null, key, paramId);
                            }
                        }
                        scope.Complete();
                    }
                }
            }
            catch (Exception ex)
            {
                WinFormsServ.Error("Ошибка при сохранении протокола: " + ex.Message);
            }

            return(true);
        }
Ejemplo n.º 5
0
 //конструктор
 public ChangeCompCelProtocol(ProtocolList owner, int iStudyLevelGroupId, int iFacultyId, int iStudyBasisId, int iStudyFormId, Guid?ProtocolId)
     : base(owner, iStudyLevelGroupId, iFacultyId, iStudyBasisId, iStudyFormId, ProtocolId)
 {
     _type       = ProtocolTypes.ChangeCompCelProtocol;
     base.sQuery = this.sQuery;
 }
Ejemplo n.º 6
0
 //конструктор
 public ChangeCompCelProtocol(ProtocolList owner, int iStudyLevelGroupId, int iFacultyId, int iStudyBasisId, int iStudyFormId)
     : this(owner, iStudyLevelGroupId, iFacultyId, iStudyBasisId, iStudyFormId, null)
 {
 }
Ejemplo n.º 7
0
 //конструктор
 public EnableProtocol(ProtocolList owner, int StudyLevelGroupId, int iFacultyId, int iStudyBasisId, int iStudyFormId)
     : base(owner, StudyLevelGroupId, iFacultyId, iStudyBasisId, iStudyFormId)
 {
     _type = ProtocolTypes.EnableProtocol;
 }
Ejemplo n.º 8
0
 //конструктор
 public DisEnableProtocol(ProtocolList owner, int iStudyLevelGroupId, int iFacultyId, int iStudyFormId, int iStudyBasisId, Guid?id)
     : base(owner, iStudyLevelGroupId, iFacultyId, iStudyBasisId, iStudyFormId, id)
 {
     _type       = ProtocolTypes.DisEnableProtocol;
     base.sQuery = this.sQuery;
 }
Ejemplo n.º 9
0
 public DisEnableProtocol(ProtocolList owner, int iStudyLevelGroupId, int iFacultyId, int iStudyFormId, int iStudyBasisId)
     : this(owner, iStudyLevelGroupId, iFacultyId, iStudyBasisId, iStudyFormId, null)
 {
 }
Ejemplo n.º 10
0
 public ProtocolCard(ProtocolList owner, int studyLevelGroupId, int facultyId, int studyBasisId, int studyFormId, int?licenseProgramId, bool isSecond, bool isReduced, bool isParallel, bool isListener, Guid?id)
     : this(owner, studyLevelGroupId, facultyId, studyBasisId, studyFormId, licenseProgramId, isSecond, isReduced, isParallel, isListener, false, id)
 {
 }
Ejemplo n.º 11
0
 //конструктор
 public ProtocolCard(ProtocolList owner, int studyLevelGroupId, int facultyId, int studyBasisId, int studyFormId, int?licenseProgramId, Guid?id) :
     this(owner, studyLevelGroupId, facultyId, studyBasisId, studyFormId, licenseProgramId, false, false, false, false, id)
 {
 }
Ejemplo n.º 12
0
 //конструктор
 public ProtocolCard(ProtocolList owner, int studyLevelGroupId, int facultyId, int studyBasisId, int studyFormId, Guid?id) :
     this(owner, studyLevelGroupId, facultyId, studyBasisId, studyFormId, null, id)
 {
 }
Ejemplo n.º 13
0
        //сохранение
        protected virtual bool Save()
        {
            //проверка данных
            if (!CheckData())
            {
                return(false);
            }

            if (dgvLeft.Rows.Count == 0)
            {
                MessageBox.Show("Нельзя создать пустой протокол!", "Внимание");
                return(false);
            }

            try
            {
                Guid ProtocolId;
                using (PriemEntities context = new PriemEntities())
                {
                    using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew))
                    {
                        try
                        {
                            if (!isNew && _type == ProtocolTypes.EntryView)
                            {
                                context.Protocol_UpdateIsOld(true, _id);
                            }

                            ObjectParameter paramId = new ObjectParameter("id", typeof(Guid));

                            if (_id.HasValue)
                            {
                                ProtocolId = _id.Value;
                                context.Protocol_ClearHistory(ProtocolId);
                            }
                            else
                            {
                                int iProtocolTypeId = ProtocolList.TypeToInt(_type);

                                context.Protocol_InsertAll(_studyLevelGroupId,
                                                           _facultyId, _licenseProgramId, _studyFormId, _studyBasisId, tbNum.Text, dtpDate.Value, iProtocolTypeId,
                                                           string.Empty, !isNew, _parentProtocolId, _isSecond, _isReduced, _isParallel, _isListener, _isForeign, paramId);

                                ProtocolId = (Guid)paramId.Value;
                            }
                            //сохраняем людей в протоколе
                            foreach (DataGridViewRow rw in dgvLeft.Rows)
                            {
                                Guid abId = new Guid(rw.Cells["Id"].Value.ToString());
                                context.ProtocolHistory_Insert(abId, ProtocolId, false, null, null, paramId);
                            }

                            transaction.Complete();
                        }
                        catch (Exception exc)
                        {
                            WinFormsServ.Error("Ошибка при сохранении данных: ", exc);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WinFormsServ.Error("Ошибка при сохранении протокола: ", ex);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 14
0
 //конструктор
 public EntryViewProtocol(ProtocolList owner, int iStudyLevelGroupId, int sFac, int sSection, int sForm, int?sProf, bool isSec, bool isReduced, bool isParal, bool isList, bool isCel, Guid?sProtocol)
     : base(owner, iStudyLevelGroupId, sFac, sSection, sForm, sProf, isSec, isReduced, isParal, isList, isCel, sProtocol)
 {
     _type = ProtocolTypes.EntryView;
 }
Ejemplo n.º 15
0
 public EntryViewProtocol(ProtocolList owner, int iStudyLevelGroupId, int sFac, int sSection, int sForm, int?sProf, bool isSec, bool isReduced, bool isParal, bool isList, bool isCel)
     : this(owner, iStudyLevelGroupId, sFac, sSection, sForm, sProf, isSec, isReduced, isParal, isList, isCel, null)
 {
 }