Пример #1
0
        private void SummaryCollection(object sender, EventArgs e)
        {
            btnSummaryCollection.BackColor = Color.BurlyWood;
            Cursor preCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;
            Library.AllCtrlSwInForm(this, false);
            IsDoing = true;

            try
            {
                SummaryRequestParam reqParam = new SummaryRequestParam();
                reqParam.ModelID = ModelID;

                bool isPredict = false;
                Dictionary <string, string> xTypeDict = Library.MakeStringDict(lstXtypeJp, lstXtypeEn);
                for (int r = 0; r < dgvCollection.Rows.Count; r++)
                {
                    string key = (string)dgvCollection[2, r].Value;
                    xTypeDict.TryGetValue((string)dgvCollection[3, r].Value, out string val);
                    reqParam.ParamDict.Add(key, val);
                    if ((bool)dgvCollection[0, r].Value)
                    {
                        reqParam.Yname = key;
                        isPredict      = true;
                    }
                }
                reqParam.Purpose      = Purpose;
                reqParam.IgnoreCheckY = 0;

                InputFormData <SummaryRequestParam> iData = new InputFormData <SummaryRequestParam>
                {
                    SettingFile  = SettingFile,
                    RequestParam = reqParam
                };
                SummaryResultData data = SummaryCommand.Collection(iData);
                if (data.MsgType != 0)
                {
                    return;
                }

                string   tempPath = AppDomain.CurrentDomain.BaseDirectory;
                FileInfo tempFile = new FileInfo(Path.Combine(tempPath, "Templates", "SummaryReport.xlsx"));

                MsgBox.MsgBoxShowInfo(String.Format("サマリ詳細出力が完了しました。\r\n出力先:{0}", tbSelectOutFolder.Text));
            }
            catch (Exception ex)
            {
                MsgBox.MsgBoxShowErr(ex.Message);
            }
            finally
            {
                Library.AllCtrlSwInForm(this, true);
                Cursor.Current = preCursor;
                btnSummaryCollection.BackColor = Color.Empty;
                IsDoing = false;
            }
        }
Пример #2
0
        private void CollectionStart(object sender, EventArgs e)
        {
            btnCollectionStart.BackColor = Color.BurlyWood;
            Cursor preCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;
            Library.AllCtrlSwInForm(this, false);
            IsDoing = true;

            try
            {
                if (String.IsNullOrEmpty(tbModelName.Text) && String.IsNullOrWhiteSpace(tbModelName.Text))
                {
                    throw new Exception("モデル名が未入力です。");
                }
                if (ModelID == null)
                {
                    throw new Exception("DS_Nameが見つかりません。");
                }
                SummaryRequestParam paras = new SummaryRequestParam
                {
                    ModelID = ModelID
                };
                Dictionary <string, string> purposeDict = Library.MakeStringDict(lstPurposeJp, lstPurposeEn);
                string purpose = cbPurpose.SelectedItem.ToString();
                purposeDict.TryGetValue(purpose, out string resPurpose);
                if (resPurpose == null)
                {
                    resPurpose = "CLF";
                }
                paras.Purpose      = resPurpose;
                paras.IgnoreCheckY = 1;
                InputFormData <SummaryRequestParam> data = new InputFormData <SummaryRequestParam>
                {
                    SettingFile  = SettingFile,
                    RequestParam = paras
                };

                var rsltData = SummaryCommand.Collection(data);
                if (rsltData.MsgType == 0)
                {
                    rsltData.ModelName = tbModelName.Text;
                    InputFormData <SummaryResultData> iData = new InputFormData <SummaryResultData>
                    {
                        SettingFile  = SettingFile,
                        RequestParam = rsltData,
                        BookPath     = BookPath,
                        ModelIdFile  = ModelIdFile
                    };
                    iData.RequestParam.ModelID = ModelID;
                    Form form = new ModelCreateForm(iData);
                    form.Show(this);
                    RibbonMenu.menuForm = form;
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (Exception ex)
            {
                MsgBox.MsgBoxShowErr(ex.Message);
                this.Close();
                this.Dispose();
            }
            finally
            {
                Library.AllCtrlSwInForm(this, true);
                Cursor.Current = preCursor;
                btnCollectionStart.BackColor = Color.Empty;
                IsDoing = false;
                if (!this.IsDisposed)
                {
                    this.Hide();
                }
            }
        }