Example #1
0
        public SportDocs(DB_Connector connection, ApplicationEdit parent)
        {
            InitializeComponent();

            _DB_Connection = connection;
            _Parent        = parent;
            _DB_Helper     = new DB_Helper(_DB_Connection);

            cbDocType.Items.Add(DB_Helper.SportAchievementGTO);
            cbDocType.Items.Add(DB_Helper.SportAchievementWorldChampionship);
            cbDocType.Items.Add(DB_Helper.SportAchievementEuropeChampionship);
            foreach (string itemName in _DB_Helper.GetDictionaryItems(FIS_Dictionary.SPORT_DIPLOMA_TYPE).Values)
            {
                cbDocType.Items.Add(itemName);
            }
            cbDocType.SelectedIndex = 0;

            Forms.ApplicationEdit.SDoc loadedDocument = _Parent.SportDoc;
            if ((loadedDocument.diplomaType != null) && (loadedDocument.diplomaType != ""))
            {
                cbDocType.SelectedItem = loadedDocument.diplomaType;
                tbDocName.Text         = loadedDocument.docName;
                dtpDocDate.Value       = loadedDocument.docDate;
                tbOrgName.Text         = loadedDocument.orgName;
            }
        }
        public IHttpActionResult UpdateApplication(ApplicationEdit model, int id)
        {
            var applicationService = CreateApplicationServices();
            var application        = applicationService.UpdateApplication(model, id);

            return(Ok("Update successfull"));
        }
Example #3
0
File: Olymps.cs Project: SahsaB/pk
        public Olymps(DB_Connector connection, ApplicationEdit parent)
        {
            InitializeComponent();

            _DB_Connection = connection;
            _DB_Helper     = new DB_Helper(_DB_Connection);
            _Parent        = parent;

            cbDiplomaType.Items.AddRange(_DB_Helper.GetDictionaryItems(FIS_Dictionary.DIPLOMA_TYPE).Values.ToArray());
            cbClass.SelectedItem = "10";
            cbDiscipline.Items.AddRange(_DB_Helper.GetDictionaryItems(FIS_Dictionary.SUBJECTS).Values.ToArray());
            cbCountry.Items.AddRange(_DB_Helper.GetDictionaryItems(FIS_Dictionary.COUNTRY).Values.ToArray());

            Forms.ApplicationEdit.ODoc loadedDocument = _Parent.OlympicDoc;

            if ((loadedDocument.olympType != null) && (loadedDocument.olympType != ""))
            {
                cbOlympType.SelectedItem = loadedDocument.olympType;
                tbDocNumber.Text         = loadedDocument.olympDocNumber.ToString();

                if ((loadedDocument.diplomaType != null) && (loadedDocument.diplomaType != ""))
                {
                    cbDiplomaType.SelectedItem = loadedDocument.diplomaType;
                }

                if (loadedDocument.olympID != 0)
                {
                    tbOlympID.Text            = loadedDocument.olympID.ToString();
                    cbOlympName.SelectedIndex = cbOlympName.FindString(_DB_Connection.Select(DB_Table.DICTIONARY_19_ITEMS, new string[] { "olympic_name" }, new System.Collections.Generic.List <Tuple <string, Relation, object> >
                    {
                        new Tuple <string, Relation, object>("olympic_id", Relation.EQUAL, loadedDocument.olympID)
                    })[0][0].ToString());
                    cbOlympProfile.SelectedIndex = cbOlympProfile.FindString(loadedDocument.olympProfile);
                }
                else
                {
                    if (loadedDocument.olympName != null)
                    {
                        cbOlympName.Text = loadedDocument.olympName;
                    }
                    cbOlympProfile.SelectedItem = loadedDocument.olympProfile;
                }

                if (loadedDocument.olympClass != 0)
                {
                    cbClass.SelectedItem = loadedDocument.olympClass.ToString();
                }

                if ((loadedDocument.olympDist != null) && (loadedDocument.olympDist != ""))
                {
                    cbDiscipline.SelectedItem = loadedDocument.olympDist;
                }

                if ((loadedDocument.country != null) && (loadedDocument.country != ""))
                {
                    cbCountry.SelectedItem = loadedDocument.country;
                }
            }
        }
Example #4
0
        public static void Report(System.Type type, System.Collections.Hashtable parameters, System.Exception ex)
        {
            LogTypes enmLogType = LogTypes.Both;

            try
            {
                byte bytLogType = System.Convert.ToByte(ApplicationEdit.GetValue("DefaultLogType", "0"));
                enmLogType = (LogTypes)bytLogType;
            }
            catch { }

            Report(type, parameters, ex, enmLogType);
        }
        public IHttpActionResult PutApplication(ApplicationEdit application)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var service = CreateApplicationService();

            if (!service.UpdateApplication(application))
            {
                return(InternalServerError());
            }
            return(Ok());
        }
Example #6
0
        private static bool LogToFile(string message)
        {
            bool blnResult = false;

            string strLogPathName =
                ApplicationEdit.GetValue("RootRelativeApplicationLogPathName");

            if (string.IsNullOrEmpty(strLogPathName) == false)
            {
                // **************************************************
                if ((System.Web.HttpContext.Current != null) && (System.Web.HttpContext.Current.Application != null))
                {
                    strLogPathName =
                        System.Web.HttpContext.Current.Server.MapPath(strLogPathName);

                    System.Web.HttpContext.Current.Application.Lock();
                }
                // **************************************************

                System.IO.StreamWriter oStreamWriter = null;
                try
                {
                    oStreamWriter =
                        new System.IO.StreamWriter(strLogPathName, true, System.Text.Encoding.UTF8);

                    oStreamWriter.WriteLine(message);
                    oStreamWriter.Close();

                    blnResult = true;
                }
                catch { }
                finally
                {
                    if (oStreamWriter != null)
                    {
                        oStreamWriter.Dispose();
                        oStreamWriter = null;
                    }
                }

                // **************************************************
                if ((System.Web.HttpContext.Current != null) && (System.Web.HttpContext.Current.Application != null))
                {
                    System.Web.HttpContext.Current.Application.UnLock();
                }
                // **************************************************
            }
            return(blnResult);
        }
Example #7
0
File: Main.cs Project: SahsaB/pk
 private void dgvApplications_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (Classes.Settings.CurrentCampaignID == 0)
     {
         MessageBox.Show("Не выбрана текущая кампания. Перейдите в Главное меню -> Приемная кампания -> Приемные кампании.");
     }
     else
     {
         _SelectedAppID = (uint)(int)dgvApplications.CurrentRow.Cells[dgvApplications_ID.Index].Value;
         StopTableAutoUpdating();
         Form form;
         if (_DB_Helper.GetCampaignType(Classes.Settings.CurrentCampaignID) == DB_Helper.CampaignType.MASTER)
         {
             form = new ApplicationMagEdit(_DB_Connection, Classes.Settings.CurrentCampaignID, _UserLogin, _SelectedAppID);
         }
         else
         {
             List <object[]> campaidnEduLevels = _DB_Connection.Select(DB_Table._CAMPAIGNS_HAS_DICTIONARIES_ITEMS, new string[] { "dictionaries_items_item_id" },
                                                                       new List <Tuple <string, Relation, object> >
             {
                 new Tuple <string, Relation, object>("campaigns_id", Relation.EQUAL, Classes.Settings.CurrentCampaignID),
                 new Tuple <string, Relation, object>("dictionaries_items_dictionary_id", Relation.EQUAL, (uint)FIS_Dictionary.EDU_LEVEL)
             });
             bool spo = false;
             foreach (object[] eduLevel in campaidnEduLevels)
             {
                 if (DB_Helper.EduLevelSPO == _DB_Helper.GetDictionaryItemName(FIS_Dictionary.EDU_LEVEL, (uint)eduLevel[0]))
                 {
                     spo = true;
                 }
             }
             if (spo)
             {
                 form = new ApplicationSPOEdit(_DB_Connection, Classes.Settings.CurrentCampaignID, _UserLogin, _SelectedAppID);
             }
             else
             {
                 form = new ApplicationEdit(_DB_Connection, Classes.Settings.CurrentCampaignID, _UserLogin, _SelectedAppID);
             }
         }
         form.ShowDialog();
         UpdateApplicationsTable();
         timer.Start();
     }
 }
 public bool UpdateApplication(ApplicationEdit model, int id)
 {
     using (var ctx = new ApplicationDbContext())
     {
         var query = ctx
                     .Applications
                     .SingleOrDefault(e => e.Id == id && e.Ownerid == _userId);
         if (query is null)
         {
             return(false);
         }
         if (query.Id != id)
         {
             return(false);
         }
         query.JobId = model.JobId;
         return(ctx.SaveChanges() == 1);
     }
 }
        public bool UpdateApplication(ApplicationEdit model)
        {
            using (var context = new ApplicationDbContext())
            {
                var entity =
                    context
                    .Applications
                    .Single(e => e.Id == model.Id && e.StudentId == _userId);
                entity.CompanyName       = model.CompanyName;
                entity.ApplicationStatus = model.ApplicationStatus;
                entity.Contacts          = model.Contacts;
                entity.DateModifiedUtc   = DateTimeOffset.Now;
                entity.JobLink           = model.JobLink;
                entity.JobLocation       = model.JobLocation;
                entity.PositionName      = model.PositionName;
                entity.Research          = model.Research;
                entity.SourceOfPosting   = model.SourceOfPosting;
                entity.Id        = model.Id;
                entity.StudentId = _userId;

                return(context.SaveChanges() == 1);
            }
        }
 protected override void OnActivated(EventArgs e)
 {
     base.OnActivated(e);
     ApplicationEdit.Focus();
 }