Exemple #1
0
 public FormA()
 {
     InitializeComponent();
     this.MdiParent = MainClass.mainform;
     bdcInet.OpenDatabase(MainClass.connStringOnline);
     GetKC();
     try
     {
         wc = new NewWatch(DateTime.Now.Date > _One ? (DateTime.Now.Date > _Two ? 33 : 22) : 11);
         wc.Show();
         Fill_1();
         if (DateTime.Now.Date > _One)
         {
             Fill_2();
         }
         if (DateTime.Now.Date > _Two)
         {
             Fill_3();
         }
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
     wc.Close();
     wc = null;
     bdcInet.CloseDataBase();
 }
Exemple #2
0
        public DocsClass(int personBarcode, int?abitCommitBarcode)
        {
            _bdcInet      = new DBPriem();
            _bdcInetFiles = new DBPriem();
            try
            {
                _bdcInet.OpenDatabase(MainClass.connStringOnline);
                _bdcInetFiles.OpenDatabase(MainClass.connStringOnlineFiles);
            }
            catch (Exception exc)
            {
                WinFormsServ.Error(exc.Message);
            }

            _personId = _bdcInet.GetStringValue("SELECT Person.Id FROM Person WHERE Person.Barcode = " + personBarcode);

            if (abitCommitBarcode == null)
            {
                _abitId = null;
            }
            else
            {
                _abitId   = _bdcInet.GetStringValue("SELECT qAbiturient.Id FROM qAbiturient WHERE qAbiturient.CommitNumber = " + abitCommitBarcode);
                _commitId = _bdcInet.GetStringValue("SELECT qAbiturient.CommitId FROM qAbiturient WHERE qAbiturient.CommitNumber = " + abitCommitBarcode);
            }
        }
 public LoadFromInet()
 {
     _bdcInet = new DBPriem();
     try
     {
         _bdcInet.OpenDatabase(MainClass.connStringOnline);
     }
     catch (Exception exc)
     {
         WinFormsServ.Error(exc.Message);
     }
 }
Exemple #4
0
        /// <summary>
        /// opens DataBase
        /// </summary>
        /// <param name="connectionString"></param>
        public static void Init(Form mf)
        {
            try
            {
                _bdc = new DBPriem();
                _bdc.OpenDatabase(connString);

                mainform = mf;
                userName = System.Environment.UserName;

                // database constant id
                using (PriemEntities context = new PriemEntities())
                {
                    //постоянный id страны Россия
                    countryRussiaId         = 1;
                    countryRussiaId_Foreign = 193;
                    //постоянный id типа уч.заведения Школа
                    educSchoolId = 1;
                    //постоянный id типа паспорта Паспорт РФ
                    pasptypeRFId = 1;
                    //постоянный id олимпиады СПбГУ
                    olympSpbguId = 3;


                    var dicSettings = context.C_AppSettings.Select(x => new { x.ParamKey, x.ParamValue }).ToList().ToDictionary(x => x.ParamKey, y => y.ParamValue);
                    sPriemYear = dicSettings.ContainsKey("PriemYear") ? dicSettings["PriemYear"] : DateTime.Now.Year.ToString();
                    iPriemYear = int.Parse(sPriemYear);

                    string tmp = dicSettings.ContainsKey("b1kCheckProtocolsEnabled") ? dicSettings["b1kCheckProtocolsEnabled"] : "False";
                    b1kCheckProtocolsEnabled = bool.Parse(tmp);

                    tmp = dicSettings.ContainsKey("bMagCheckProtocolsEnabled") ? dicSettings["bMagCheckProtocolsEnabled"] : "False";
                    bMagCheckProtocolsEnabled = bool.Parse(tmp);
                }

                if (dbType == PriemType.Priem)
                {
                    studyLevelGroupId = 1;
                }
                else
                {
                    studyLevelGroupId = 2;
                }

                directory      = string.Format(@"{0}\Priem", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
                saveTempFolder = string.Format(@"{0}\DocTempFiles", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
                try
                {
                    // уточнить у Дениса, кто создавал эту папку!!!!! может будет ошибка
                    if (!Directory.Exists(directory))
                    {
                        Directory.CreateDirectory(directory);
                    }

                    // Determine whether the directory exists.
                    if (!Directory.Exists(saveTempFolder))
                    {
                        Directory.CreateDirectory(saveTempFolder);
                    }
                }
                catch (Exception e)
                {
                }

                //взяли конфиг
                _config = GetConfig();
            }
            catch (Exception e)
            {
                throw e;
            }
        }