private void EditCriteria(object sender, EventArgs e)
        {
            if (Timetable == null)
            {
                return;
            }

            var formCriteria = new FormCriteria();

            if (formCriteria.ShowDialog(Solver) != DialogResult.OK)
            {
                return;
            }
            Timetable.RecomputeSolutions = true;
        }
        private void ButtonCriteriaClick(object sender, EventArgs e)
        {
            var formCriteria = new FormCriteria();

            // if the criteria dialog was shown and nothing changed, all good
            if (formCriteria.ShowDialog(_solver) != DialogResult.OK)
            {
                return;
            }

            _solver.Timetable.RecomputeSolutions = true;
            var formProgress = new FormProgress();

            formProgress.ShowDialog(_solver);

            Reset();
        }
        private void ButtonCriteriaClick(object sender, EventArgs e)
        {
            if (_form == null || _form.Timetable == null)
            {
                MessageBox.Show("Please import a timetable before setting solver criteria.", "Criteria",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            var formCriteria = new FormCriteria();

            if (formCriteria.ShowDialog(_form.Solver) != DialogResult.OK)
            {
                return;
            }
            _form.Timetable.RecomputeSolutions = true;
        }
예제 #4
0
        public async Task <FormCriteria> GetFormCriteriaAsync(string userName)
        {
            using (var Db = new AtmContext())
            {
                // Create command from the context in order to execute
                // the `GetReferrer` proc
                var command = Db.Database.Connection.CreateCommand();
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = $"[dbo].[up_p_getFormCriteria]";
                command.Parameters.Add(new SqlParameter("@userName", userName));

                var result = new FormCriteria();

                try
                {
                    Db.Database.Connection.Open();
                    var reader = await command.ExecuteReaderAsync();

                    // Drop down to the wrapped `ObjectContext` to get access to
                    // the `Translate` method
                    var objectContext = ((IObjectContextAdapter)Db).ObjectContext;
                    result.Status = objectContext.Translate <FormStatus>(reader).ToList();//(reader, 0, MergeOption.AppendOnly);

                    reader.NextResult();
                    result.FormType = objectContext.Translate <FormType>(reader).ToList();//, "Set2", MergeOption.AppendOnly);

                    reader.NextResult();
                    result.Centers = objectContext.Translate <SygmaCenter>(reader).ToList();//, "Set3", MergeOption.AppendOnly);
                }
                finally
                {
                    Db.Database.Connection.Close();
                }

                return(result);
            }
        }