Example #1
0
 public void Save()
 {
     _presenter.Save();
 }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var SpecialFaculty = 1231;
            //var Speciality = 50;
            var StudYear          = 22;
            var FormEduc          = 1;
            var ModeEduc          = 1;
            var StudYearIDVersion = 22;


            //var WTP = DBManager.GetDataSourse<IWTP>().Rows.Cast<IWTP>().
            //     Where(r => r.SPECIALFACULTY_ID == SpecialFaculty).
            //     Where(r => r.STUDYEAR_ID == StudYear).
            //     Where(r => r.FORMEDUC_ID == FormEduc).
            //     Where(r => r.MODEEDUC_ID == ModeEduc).
            //     Where(r => r.STUDYEAR_ID_VERSION == StudYearIDVersion);

            WtpPresenter planPresenter = new WtpPresenter();

            //if (WTP.Count() == 0) { }
            //{

            if (WTP_ID == null)
            {
                Wtp plan = planPresenter.CreateWtp();
                plan.DataRow.SPECIALFACULTY_ID = 1231;
                //plan.DataRow.SPECIALITY_ID = 50;
                plan.DataRow.STUDYEAR_ID         = 22;
                plan.DataRow.FORMEDUC_ID         = 1;
                plan.DataRow.MODEEDUC_ID         = 1;
                plan.DataRow.STUDYEAR_ID_VERSION = 22;
                planPresenter.Save();
                WTP_ID = (long)plan.DataRow.WTP_ID;
            }
            else
            {
                planPresenter.Load((long)WTP_ID);
                var plan = planPresenter.Plan;
            }



            ImportPlanExample importer = new ImportPlanExample();
            XDocument         xdoc     = XDocument.Load(ofd.FileName);


            //planPresenter.Load(1297);
            if (importer.CheckImportFile(planPresenter.Plan, xdoc, out string ErrorMessage))
            {
                if (MessageBox.Show(ErrorMessage + " Продолжить?", "Импорт УП", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                {
                    return;
                }
            }

            if (!importer.Import(planPresenter, xdoc, out string ErrorMessage2))
            {
                MessageBox.Show(ErrorMessage);
            }
        }