Esempio n. 1
0
        /// <summary>
        /// 追加対象のユーザー若しくはEAの情報を取得しcheckedListBoxにアイテムとして登録する
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_get_addData_Click(object sender, EventArgs e)
        {
            dynamic json_obj = "";
            bool    status   = false;
            string  error    = "";

            // データ削除
            clb_target_data.Items.Clear();

            // 対象データ取得
            string result = http_Request_CTRL.http_get(get_add_mode_url(), out status);

            // データをjsonとして取り出し
            Json_Add_User JAU = new Json_Add_User();

            json_obj = JAU.Json_accept(result, out status, out error);

            if (json_obj != null)
            {
                // json化したデータを1レコード毎に分解して表示項目の並べ替えを実施した上でcheckedListBoxへ投入
                foreach (dynamic read_user in (object[])json_obj)
                {
                    System.Console.WriteLine(read_user.Stc_ID + read_user.MT4_Server);
                    string json = "";
                    json  = "{";
                    json += "\"" + "Stc_ID" + "\"" + ":" + "\"" + read_user.Stc_ID + "\",";
                    json += "\"" + "MT4_Server" + "\"" + ":" + "\"" + read_user.MT4_Server + "\",";
                    json += "\"" + "MT4_ID" + "\"" + ":" + "\"" + read_user.MT4_ID + "\",";
                    json += "\"" + "Ccy" + "\"" + ":" + "\"" + read_user.Ccy + "\",";
                    json += "\"" + "Time_Period" + "\"" + ":" + "\"" + read_user.Time_Period + "\",";
                    json += "\"" + "EA_ID" + "\"" + ":" + "\"" + read_user.EA_ID + "\",";
                    json += "\"" + "Stc_Pwd" + "\"" + ":" + "\"" + read_user.Stc_Pwd + "\",";
                    json += "\"" + "Join_Time" + "\"" + ":" + "\"" + read_user.Join_Time + "\",";
                    json += "\"" + "Join_Time2" + "\"" + ":" + "\"" + read_user.Join_Time2 + "\",";
                    json += "\"" + "Mail_Address" + "\"" + ":" + "\"" + read_user.Mail_Address + "\",";
                    json += "\"" + "Last_Name" + "\"" + ":" + "\"" + read_user.Last_Name + "\",";
                    json += "\"" + "First_Name" + "\"" + ":" + "\"" + read_user.First_Name + "\",";
                    json += "\"" + "Stc_Name" + "\"" + ":" + "\"" + read_user.Stc_Name + "\",";
                    json += "\"" + "Broker_Name" + "\"" + ":" + "\"" + read_user.Broker_Name + "\",";
                    json += "\"" + "MT4_Pwd" + "\"" + ":" + "\"" + read_user.MT4_Pwd + "\",";
                    json += "\"" + "EA_Name" + "\"" + ":" + "\"" + read_user.EA_Name + "\",";
                    json += "\"" + "Course" + "\"" + ":" + "\"" + read_user.Course + "\",";
                    json += "\"" + "Vol_1shot" + "\"" + ":" + "\"" + read_user.Vol_1shot + "\",";
                    json += "\"" + "memo" + "\"" + ":" + "\"" + read_user.memo + "\",";
                    json += "\"" + "A_Start" + "\"" + ":" + "\"" + read_user.A_Start + "\",";
                    json += "\"" + "Ope_Tag" + "\"" + ":" + read_user.Ope_Tag + ",";
                    json += "\"" + "Check_Status" + "\"" + ":" + "\"" + read_user.Check_Status + "\"}";

                    //clb_target_data.Items.Add(read_user);
                    clb_target_data.Items.Add(json);
                }
            }
            else
            {
                MessageBox.Show("対象データがありません", "追加データなし!");
            }
        }
Esempio n. 2
0
        public static dynamic add_user_motion(string add_user_strings, out bool status, out string error)
        {
            dynamic json_obj = "";

            status = false;
            error  = "";

            Json_Add_User JAU = new Json_Add_User();

            json_obj = JAU.Json_accept(add_user_strings, out status, out error);


            //送受信正常結果格納用パス
            string filePaht = System.IO.Directory.GetCurrentDirectory() + @"\add_user_log";

            if (status)
            {
                //正常時、証跡の受信内容をファイル出力
                File_CTRL.Write_OK_Log(add_user_strings, filePaht + @"\Accept" + System.DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + @".txt");
            }
            else
            {
                //エラーログファイル出力
                logger.Error(" add_user.json 読み込みエラー: " + error + "\n\r" + add_user_strings);
            }

            if (json_obj != null)
            {
                // インストール用フォルダ生成
                json_obj = Create_Install_folder(json_obj, out error);

                if (error != "")
                {
                    //エラーログファイル出力
                    logger.Error(" インストールフォルダ準備エラー 対象Stc_ID:" + error + "\n\r" + add_user_strings);
                    MessageBox.Show(" インストールフォルダ準備エラー 対象Stc_ID:" + error + "\n\r STC_CONのログファイルを確認してください。\n\r一応、応答ファイルは出力しておきますが使わないでください。");
                }

                // 応答用end_init.json生成
                json_obj = Json_End_Init.end_init(json_obj, out status, out error);

                if (status)
                {
                    //正常時、証跡の送信内容をファイル出力
                    File_CTRL.Write_OK_Log(json_obj.ToString(), filePaht + @"\Send" + System.DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + @".txt");
                }
                else
                {
                    //エラーログファイル出力
                    logger.Error(" end_init.json 応答準備エラー: " + error + "\n\r" + add_user_strings);
                }
            }

            return(json_obj);
        }