Ejemplo n.º 1
0
        private static bool ImportToSKS(string jsResult)
        {
            try
            {
                string SKSPath = loginbl.GetInformationOfIniFileByKey("SKS_Path");

                var http = (HttpWebRequest)WebRequest.Create(new Uri(SKSPath));
                http.Accept      = "application/json";
                http.ContentType = "application/json";
                http.Method      = "POST";
                string   parsedContent = jsResult;
                Encoding encoding      = Encoding.UTF8;
                Byte[]   bytes         = encoding.GetBytes(parsedContent);
                http.Timeout = System.Threading.Timeout.Infinite;

                http.ReadWriteTimeout = System.Threading.Timeout.Infinite;
                Stream newStream = http.GetRequestStream();
                newStream.Write(bytes, 0, bytes.Length);
                newStream.Close();

                var response = http.GetResponse();
                var stream   = response.GetResponseStream();
                var sr       = new StreamReader(stream);
                var content  = sr.ReadToEnd();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        protected override void PrintSec()
        {
            DataTable dtForUpdate = null;

            try
            {
                // レコード定義を行う
                DataTable table = CheckData(out dtForUpdate);

                if (table == null)
                {
                    return;
                }

                //Q205
                if (bbl.ShowMessage("Q205") != DialogResult.Yes)
                {
                    return;
                }

                //EXCEL出力
                string filePath = "";
                //出力ファイル名の決定
                if (!ShowSaveFileDialog(InProgramNM, out filePath, 1))
                {
                    return;
                }

                // 実行モジュールと同一フォルダのファイルを取得
                Login_BL loginbl          = new Login_BL();
                string   templateFilePath = loginbl.GetInformationOfIniFileByKey(InProgramID);

                //テンプレートのファイル存在チェック
                if (!System.IO.File.Exists(templateFilePath))
                {
                    //Todo:変更
                    bbl.ShowMessage("E122");
                    return;
                }

                //テンプレートをコピーしてファイルを保存(上書きOK)
                System.IO.File.Copy(@templateFilePath, @filePath, true);

                //Excel出力
                OutputExecelFromDataTable(table, filePath);

                //更新処理
                //tableの見積番号だけ
                try
                {
                    stbl.D_Purchase_Update(dpe, dtForUpdate);
                }
                catch (Exception ex)
                {
                    var f = ex.Message;
                }

                //ログファイルへの更新
                bbl.L_Log_Insert(Get_L_Log_Entity());

                //ファイル出力が完了しました。
                bbl.ShowMessage("I203");
            }
            finally
            {
                DeleteExclusive(dtForUpdate);
            }
            //更新後画面そのまま
            detailControls[1].Focus();
        }