Esempio n. 1
0
        /// <summary>
        /// Gets the HTTP response for the Get Stock items API
        /// </summary>
        /// <param name="pageIndex">Page Index</param>
        /// <returns>HTTP response from the API</returns>
        public async Task <HttpResponseMessage> GetStockItems(int pageIndex)
        {
            var url    = string.Format(Urls.GetStockItems, PageSize, pageIndex);
            var client = new HttpRestClient(true);

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 2
0
        public async Task <HttpResponseMessage> RefreshPolicies()
        {
            var client = new HttpRestClient(true);
            var url    = string.Format(Urls.RefreshPolicies, _cacheManager.TillNumber, _cacheManager.SaleNumber);

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
        public IList <JobAdvanceReportFilter> GetDropDownDataForProgram(long customerId, string entity)
        {
            var request = HttpRestClient.RestAuthRequest(Method.GET, string.Format("{0}/{1}", RouteSuffix, "AdvanceReport"), ActiveUser).AddParameter("customerId", customerId).AddParameter("entity", entity);
            var result  = RestClient.Execute(request);

            return(JsonConvert.DeserializeObject <ApiResult <List <JobAdvanceReportFilter> > >(result.Content).Results?.FirstOrDefault());
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the Bottles
        /// </summary>
        /// <param name="pageId">Page id</param>
        /// <returns>HTTP Response from the API</returns>
        public async Task <HttpResponseMessage> GetBottles(int pageId)
        {
            var url    = string.Format(Urls.GetBottlesUrl, pageId);
            var client = new HttpRestClient(true);

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 5
0
 public bool AcceptJobXcblInfo(long jobId, long gatewayId)
 {
     return(JsonConvert.DeserializeObject <ApiResult <bool> >(
                RestClient.Execute(
                    HttpRestClient.RestAuthRequest(Method.GET, string.Format("{0}/{1}", RouteSuffix, "AcceptJobXcblInfo"), ActiveUser)
                    .AddParameter("jobId", jobId).AddParameter("gatewayId", gatewayId)).Content).Results.FirstOrDefault());
 }
Esempio n. 6
0
        public IList <JobCostCodeAction> GetJobCostCodeAction(long jobId)
        {
            var content   = RestClient.Execute(HttpRestClient.RestAuthRequest(Method.GET, string.Format("{0}/{1}", RouteSuffix, "JobCostCodeAction"), ActiveUser).AddParameter("jobId", jobId)).Content;
            var apiResult = JsonConvert.DeserializeObject <ApiResult <JobCostCodeAction> >(content);

            return(apiResult.Results);
        }
        public DocumentDataView GetPriceCodeReportByJobId(string jobId)
        {
            var request = HttpRestClient.RestAuthRequest(Method.GET, string.Format("{0}/{1}", RouteSuffix, "GetPriceCodeReportByJobId"), ActiveUser).AddParameter("jobId", jobId);
            var result  = RestClient.Execute(request);

            return(JsonConvert.DeserializeObject <ApiResult <DocumentDataView> >(result.Content).Results?.FirstOrDefault());
        }
Esempio n. 8
0
        public async Task <HttpResponseMessage> GetLoginPolicyAsync(string ipAddress)
        {
            var httpClient = new HttpRestClient(true);
            var url        = string.Format(Urls.LoginPolicies, ipAddress);

            return(await httpClient.GetAsync(url));
        }
Esempio n. 9
0
        public async Task <HttpResponseMessage> GetPasswordAsync(string userName)
        {
            var url        = string.Format(Urls.GetPassword, userName);
            var httpClient = new HttpRestClient(true);

            return(await httpClient.GetAsync(url));
        }
Esempio n. 10
0
        public async Task <HttpResponseMessage> VerifyMultiPO(string purchaseOrder)
        {
            var client = new HttpRestClient();
            var url    = string.Format(Urls.VerfifyMultiPO, _cacheManager.SaleNumber, _cacheManager.TillNumber, purchaseOrder);

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 11
0
        public async Task <HttpResponseMessage> GetVendorCoupon(string vendorCode)
        {
            var client = new HttpRestClient();
            var url    = string.Format(Urls.GetVendorCoupon, _cacheManager.SaleNumber, _cacheManager.TillNumber, vendorCode);

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 12
0
        /// <summary>
        /// Gets the Sale summary
        /// </summary>
        /// <param name="saleNumber">Sale number</param>
        /// <param name="tillNumber">Till number</param>
        /// <param name="registerNumber">Register number</param>
        /// <returns></returns>
        public async Task <HttpResponseMessage> SaleSummary(HttpContent content, double?kickBackAmount)
        {
            var client = new HttpRestClient();
            var url    = string.Format(Urls.SaleSummary, kickBackAmount);

            return(await client.PostAsync(url, content, _cacheManager.AuthKey));
        }
Esempio n. 13
0
        /// <summary>
        /// Method to get treaty Name
        /// </summary>
        /// <param name="treatyNumber"></param>
        /// <param name="captureMethod"></param>
        /// <returns></returns>
        public async Task <HttpResponseMessage> GetTreatyName(string treatyNumber, string captureMethod)
        {
            var url    = string.Format(Urls.GetTreatyName, treatyNumber, captureMethod);
            var client = new HttpRestClient();

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 14
0
        private static HttpRestClient CreateHttpRestClient()
        {
            const string remoteHost = "https://swapi.co/api/";
            var          httpClient = new HttpRestClient(remoteHost);

            return(httpClient);
        }
Esempio n. 15
0
        /// <summary>
        /// Gets the Over limit details for the current sale
        /// </summary>
        /// <param name="saleNumber">Sale number</param>
        /// <param name="tillNumber">Till number for the Current Sale</param>
        /// <returns></returns>
        public async Task <HttpResponseMessage> OverLimitDetails(int saleNumber, int tillNumber)
        {
            var url    = string.Format(Urls.OverLimitDetails, saleNumber, tillNumber);
            var client = new HttpRestClient();

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 16
0
        public HttpRestClient Create(Uri serverUrl, string agentId, JsonSerializer jsonSerializer)
        {
            IHttpClientProvider mockProvider         = new MockHttpClientProvider();
            HttpRestClient      mockedHttpRestClient = new HttpRestClient(serverUrl, agentId, jsonSerializer, Logger, mockProvider);

            return(mockedHttpRestClient);
        }
Esempio n. 17
0
        protected override HttpResponseMessage CloseBatchImpl_(string batchId, HttpRestClient httpClient)
        {
            HttpResponseMessage response = base.CloseBatchImpl_(batchId, httpClient);

            CloseBatchRequestUris.Add(response.RequestMessage.RequestUri);
            return(response);
        }
        public void OneTimeTearDown()
        {
            //TestContext.Progress.WriteLine($"{DateTimeOffset.Now:yyyy'-'MM'-'dd HH':'mm':'ss.fff} - Eyes: sending json: {JsonConvert.SerializeObject(reportSummary_)}");
            HttpRestClient client = new HttpRestClient(new Uri("http://sdk-test-results.herokuapp.com"));

            client.PostJson("/result", reportSummary_);
        }
Esempio n. 19
0
        /// <summary>
        /// Route to call active users
        /// </summary>
        /// <param name="login"></param>
        /// <returns></returns>
        public static ActiveUser GetActiveUser(Login login)
        {
            var activeUser = new ActiveUser();
            var result     = new RestClient(ConfigurationManager.AppSettings["WebAPIURL"]).Execute(
                HttpRestClient.RestRequest(Method.POST, "Account/Login")
                .AddObject(login)).Content;
            UserToken token = null;

            try
            {
                token = JsonConvert.DeserializeObject <ApiResult <UserToken> >(result).Results?.FirstOrDefault();
            }
            catch (System.Exception)
            {
            }

            if (token != null)
            {
                if (!string.IsNullOrEmpty(token.SystemMessage))
                {
                    activeUser.SystemMessage = token.SystemMessage;
                }
                else
                {
                    var tokenRequest = HttpRestClient.RestRequest(Method.GET, "Account/ActiveUser");
                    tokenRequest.AddHeader("Authorization", "bearer " + token.AccessToken);
                    activeUser           = JsonConvert.DeserializeObject <ApiResult <ActiveUser> >(new RestClient(ConfigurationManager.AppSettings["WebAPIURL"]).Execute(tokenRequest).Content).Results?.FirstOrDefault();
                    activeUser.AuthToken = token.AccessToken;
                }
            }
            return(activeUser);
        }
Esempio n. 20
0
        public async Task <HttpResponseMessage> GetAllPolicies()
        {
            var client = new HttpRestClient(true);
            var url    = string.Format(Urls.Policies, _cacheManager.RegisterNumber);

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 21
0
        public IList <NavPriceCodeView> GetAllPriceCode()
        {
            var request = HttpRestClient.RestAuthRequest(Method.GET, string.Format("{0}/{1}", RouteSuffix, "GetAllPriceCode"), ActiveUser);
            var result  = RestClient.Execute(request);

            return(JsonConvert.DeserializeObject <ApiResult <List <NavPriceCodeView> > >(result.Content).Results?.FirstOrDefault());
        }
Esempio n. 22
0
        public async Task <HttpResponseMessage> GetAckrooCarwashStockCode(string sDesc)
        {
            var    client = new HttpRestClient();
            string url    = string.Format(Urls.GetAckrooCarwashStockCode, sDesc);

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 23
0
        public async Task <HttpResponseMessage> GetReprintSales(string reportType, string date)
        {
            var url    = string.Format(Urls.GetReprintSales, reportType, date);
            var client = new HttpRestClient();

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 24
0
        public async Task <HttpResponseMessage> GetActiveTheme(string ipAddress)
        {
            var url    = string.Format(Urls.GetActiveTheme, ipAddress);
            var client = new HttpRestClient(true);

            return(await client.GetAsync(url));
        }
Esempio n. 25
0
        public async Task <HttpResponseMessage> GetAllCustomers(int pageIndex, bool loyalty)
        {
            var url    = string.Format(loyalty ? Urls.GetAllLoyaltyCustomers : Urls.GetAllCustomers, PageSize, pageIndex);
            var client = new HttpRestClient();

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 26
0
        public async Task <HttpResponseMessage> GetGivexReport(string date)
        {
            var url    = string.Format(Urls.GetGivexReport, date);
            var client = new HttpRestClient();

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 27
0
        /// <summary>
        /// Method to check balance for given card
        /// </summary>
        /// <param name="givexCardNumber"></param>
        /// <returns></returns>
        public async Task <HttpResponseMessage> GetCardBalance(string givexCardNumber)
        {
            var url    = string.Format(Urls.GiveXBalance, givexCardNumber, _cacheManager.SaleNumber, _cacheManager.TillNumber);
            var client = new HttpRestClient();

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
        public void Get_makesNonAuthenicatedApiCallWithNoHeaders_returnsString()
        {
            HttpRestClient client = new HttpRestClient();
            var            result = client.Get <string>("https://api.bitfinex.com/v2/ticker/tETHUSD");

            Assert.IsTrue(result.Body.StartsWith("["));
        }
Esempio n. 29
0
        /// <summary>
        /// Method to get reason Lists
        /// </summary>
        /// <param name="reason"></param>
        /// <returns></returns>
        public async Task <HttpResponseMessage> GetReasonList(string reason)
        {
            var url    = string.Format(Urls.GetReasonList, reason);
            var client = new HttpRestClient(true);

            return(await client.GetAsync(url, _cacheManager.AuthKey));
        }
Esempio n. 30
0
        public void EndToEndTest()
        {
            const string buildUrl = "http://localhost:5000/";

            byte[] expected;
            byte[] actual;

            var restClient = new HttpRestClient("https://www.google.com");


            var routing = new RoutingRestClient
            {
                DefaultRestClient = restClient,
                RoutingAction     = null
            };

            using (var service = new Server(buildUrl, routing))
            {
                var request  = TestMother.BuildRequest();
                var response = restClient.GetResponseAsync(request).Result;

                expected = response.Data;

                request        = TestMother.BuildRequest();
                request.Server = buildUrl;
                response       = restClient.GetResponseAsync(request).Result;

                actual = response.Data;
            }

            Assert.IsNotNull(expected);
            Assert.IsTrue(expected.Length > 100);
        }
Esempio n. 31
0
        /// <summary>
        /// 삭제 버튼 클릭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            // 자료일자
            DateTime dateTimeFrom = this.dateTimeFrom.Value;
            DateTime dateTimeTo = this.dateTimeTo.Value;
            DateTime curDate = DateTime.Now;

            if (dateTimeFrom.Date > dateTimeTo.Date)
            {
                MessageBox.Show("대상일자 오류입니다. (시작일이 종료일보다 큼)");
                return;
            }

            if (dateTimeTo.Date >= curDate.Date)
            {
                MessageBox.Show("삭제대상일이 현재일자보다 같거나 큽니다.");
                return;
            }

            string dateFrom = dateTimeFrom.ToString("yyyyMMdd");
            string dateTo = dateTimeTo.ToString("yyyyMMdd");
            string dataDate = dateFrom;
            if (!dateFrom.Equals(dateTo))
                dataDate += "-" + dateTo;

            // 확인
            DialogResult result = MessageBox.Show("자료일자: " + dataDate +
                "\n\n삭제하시겠습니까? 삭제는 되돌릴 수 없습니다.", "주의", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (result != DialogResult.Yes)
                return;

            // 자료 삭제요청
            // 삭제URL: manager/log/<자료일자>
            HttpRestClient client = new HttpRestClient(HttpRestClient.REST_METHOD_DELETE, "manager/error/" + dataDate);

            if (!client.doWorkDialog())
            {
                client.showErrorDialog();
                return;
            }

            MessageBox.Show("삭제요청이 처리되었습니다.", "완료");
        }
Esempio n. 32
0
        /// <summary>
        /// 다음 조회 버튼 클릭시 처리
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearchNext_Click(object sender, EventArgs e)
        {
            if (workTable == null)
            {
                MessageBox.Show("조회 후 추가 조회하세요.");
                return;
            }

            // 자료일자
            string dateFrom = this.dateTimeFrom.Value.ToString("yyyyMMdd");
            string dateTo = this.dateTimeTo.Value.ToString("yyyyMMdd");

            string dataDate = dateFrom;
            if (!dateFrom.Equals(dateTo))
                dataDate += "-" + dateTo;

            // 자료 조회
            // 조회URL: manager/log/<자료일자>?옵션
            HttpRestClient client = new HttpRestClient("manager/error/" + dataDate);

            // 조회조건
            if (comboAPIKEY.Text.Length > 0)
                client.QueryString.Add("apikey", comboAPIKEY.Text);

            if (txtRequestId.Text.Length > 0)
                client.QueryString.Add("requestid", txtRequestId.Text);

            // 페이징처리...
            if (lastNo != null && lastNo.Length > 0)
                client.QueryString.Add("startno", lastNo);

            if (!client.doWorkDialog())
            {
                client.showErrorDialog();
                return;
            }

            // 응답 데이터 처리
            dynamic json = client.getJsonObject();

            foreach (dynamic item in json.dataList)
            {
                DataRow workRow = workTable.NewRow();
                workRow["No"] = item["no"];

                string date = (string)item["date"];
                date = date.Substring(0, 4) + "-" + date.Substring(4, 2) + "-" + date.Substring(6, 2);
                workRow["Date"] = date;

                string time = (string)item["time"];
                time = time.Substring(0, 2) + ":" + time.Substring(2, 2) + ":" + time.Substring(4, 2);
                workRow["Time"] = time;

                workRow["API Key"] = item["apiKey"];
                workRow["Ticket ID"] = item["reuqestId"];
                workRow["Message"] = item["message"];
                workRow["Trace"] = item["trace"];

                workTable.Rows.Add(workRow);

                lastNo = (string)item["no"];
            }

            dataGridView1.AutoResizeColumns();
        }
Esempio n. 33
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            //조회
            MasterList master = null;
            if (radioBtn강력.Checked)
                master = DataMasterCache.getDataMasterByName("강력출동");
            else if (radioBtn거래이평.Checked)
                master = DataMasterCache.getDataMasterByName("거래20이평");

            if (master == null)
            {
                MessageBox.Show("자료 종류 중 하나를 선택하세요.", "Error");
                return;
            }

            // 자료일자
            DateTime d1 = this.datePicker1.Value;
            string dataDate1 = d1.ToString("yyyyMMdd");
            DateTime d2 = this.datePicker2.Value;
            string dataDate2 = d2.ToString("yyyyMMdd");

            Console.WriteLine("자료종류: " + master.id + ":" + master.name);
            Console.WriteLine("자료일자: " + dataDate1 + " ~ " + dataDate2);

            string dataDate = dataDate1;
            if (!dataDate1.Equals(dataDate2))
                dataDate += "-" + dataDate2;

            // 자료 조회
            // 조회URL: data/<자료종류>/<자료일자>?stockcode=종목코드
            string resource_value = master.id + "/" + dataDate;
            HttpRestClient client = new HttpRestClient("report/diffview/" + resource_value);

            // 조회조건
            if (txtStockCodes.Text.Length > 0)
                client.QueryString.Add("stockcode", txtStockCodes.Text);

            if (!client.doWorkDialog())
            {
                client.showErrorDialog();
                return;
            }

            // 응답 데이터 처리
            dynamic json = client.getJsonObject();

            DataTable workTable = new DataTable("Report");
            workTable.Columns.Add("자료일자", typeof(String));

            workTable.Columns.Add("09:30", typeof(String));
            workTable.Columns.Add("10:00", typeof(String));
            workTable.Columns.Add("11:00", typeof(String));
            workTable.Columns.Add("12:00", typeof(String));
            workTable.Columns.Add("13:00", typeof(String));
            workTable.Columns.Add("14:00", typeof(String));
            workTable.Columns.Add("15:30", typeof(String));
            workTable.Columns.Add("종목코드", typeof(String));

            foreach (dynamic item in json.dataList)
            {
                DataRow workRow = workTable.NewRow();
                string gsdate = (string)item["gsDate"];
                gsdate = gsdate.Substring(0, 4) + "-" + gsdate.Substring(4, 2) + "-" + gsdate.Substring(6, 2);
                workRow["자료일자"] = gsdate;
                string stCode = (string)item["stockCode"];
                string stName = (string)item["stockName"];
                workRow["종목코드"] = stCode;

                workRow["09:30"] = codeToName((string)item["ST0930"], stCode, stName);
                workRow["10:00"] = codeToName((string)item["ST1000"], stCode, stName);
                workRow["11:00"] = codeToName((string)item["ST1100"], stCode, stName);
                workRow["12:00"] = codeToName((string)item["ST1200"], stCode, stName);
                workRow["13:00"] = codeToName((string)item["ST1300"], stCode, stName);
                workRow["14:00"] = codeToName((string)item["ST1400"], stCode, stName);
                workRow["15:30"] = codeToName((string)item["ST1530"], stCode, stName);

                workTable.Rows.Add(workRow);
            }

            dataGridView1.DataSource = workTable;
            dataGridView1.AutoResizeColumns();
        }
Esempio n. 34
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            //조회
            MasterList master = null;
            if (radioBtn기관.Checked)
                master = DataMasterCache.getDataMasterByName("기관잠정치매매");
            else if (radioBtn외인.Checked)
                master = DataMasterCache.getDataMasterByName("외인잠정치매매");
            else if (radioBtn외인기관.Checked)
                master = DataMasterCache.getDataMasterByName("외인기관쌍끌이잠정치매매");

            if (master == null)
            {
                MessageBox.Show("자료 종류 중 하나를 선택하세요.", "Error");
                return;
            }

            // 자료일자
            DateTime d = this.datePicker.Value;
            string dataDate = d.ToString("yyyyMMdd");

            Console.WriteLine("자료종류: " + master.id + ":" + master.name);
            Console.WriteLine("자료일자: " + dataDate);

            // 자료 조회
            // 조회URL: data/<자료종류>/<자료일자>?stockcode=종목코드
            string resource_value = master.id + "/" + dataDate;
            HttpRestClient client = new HttpRestClient("report/listview/" + resource_value);

            // 조회조건
            if (txtStockCodes.Text.Length > 0)
                client.QueryString.Add("stockcode", txtStockCodes.Text);

            if (!client.doWorkDialog())
            {
                client.showErrorDialog();
                return;
            }

            // 응답 데이터 처리
            dynamic json = client.getJsonObject();

            DataTable workTable = new DataTable("Report");
            workTable.Columns.Add("종목코드", typeof(String));
            workTable.Columns.Add("종목명", typeof(String));

            workTable.Columns.Add("외0920-계", typeof(int));       // field

            workTable.Columns.Add("외0950-증감", typeof(int));
            workTable.Columns.Add("외0950-계", typeof(int));       // field
            //workTable.Columns.Add("기0950-증감", typeof(int));
            workTable.Columns.Add("기0950-계", typeof(int));       // field
            workTable.Columns.Add("0950-소계", typeof(int));
            workTable.Columns["외0950-증감"].Expression = "[외0950-계] - [외0920-계]";
            workTable.Columns["0950-소계"].Expression = "[외0950-계] + [기0950-계]";

            workTable.Columns.Add("외1100-증감", typeof(int));
            workTable.Columns.Add("외1100-계", typeof(int));       // field
            workTable.Columns.Add("기1100-증감", typeof(int));
            workTable.Columns.Add("기1100-계", typeof(int));       // field
            workTable.Columns.Add("1100-소계", typeof(int));
            workTable.Columns["외1100-증감"].Expression = "[외0950-계] - [외1100-계]";
            workTable.Columns["기1100-증감"].Expression = "[기0950-계] - [기1100-계]";
            workTable.Columns["1100-소계"].Expression = "[외1100-계] + [기1100-계]";

            workTable.Columns.Add("외1320-증감", typeof(int));
            workTable.Columns.Add("외1320-계", typeof(int));       // field
            workTable.Columns.Add("기1320-증감", typeof(int));
            workTable.Columns.Add("기1320-계", typeof(int));       // field
            workTable.Columns.Add("1320-소계", typeof(int));
            workTable.Columns["외1320-증감"].Expression = "[외1100-계] - [외1320-계]";
            workTable.Columns["기1320-증감"].Expression = "[기1100-계] - [기1320-계]";
            workTable.Columns["1320-소계"].Expression = "[외1320-계] + [기1320-계]";

            workTable.Columns.Add("외1505-증감", typeof(int));
            workTable.Columns.Add("외1505-계", typeof(int));       // field
            workTable.Columns.Add("기1505-증감", typeof(int));
            workTable.Columns.Add("기1505-계", typeof(int));       // field
            workTable.Columns.Add("1505-소계", typeof(int));
            workTable.Columns["외1505-증감"].Expression = "[외1320-계] - [외1505-계]";
            workTable.Columns["기1505-증감"].Expression = "[기1320-계] - [기1505-계]";
            workTable.Columns["1505-소계"].Expression = "[외1505-계] + [기1505-계]";

            foreach (dynamic item in json.dataList)
            {
                //DataRow[] foundRows = workTable.Select("종목코드 = '" + item["stockCode"] + "'");
                //if (foundRows == null || foundRows.Length == 0)
                //{
                DataRow workRow = workTable.NewRow();
                workRow["종목코드"] = item["stockCode"];
                workRow["종목명"] = item["stockName"];

                workRow["외0920-계"] = strToInt((string)item["fgn_0920"]);

                workRow["외0950-계"] = strToInt((string)item["fgn_0950"]);
                workRow["기0950-계"] = strToInt((string)item["inv_0950"]);
                workRow["외1100-계"] = strToInt((string)item["fgn_1100"]);
                workRow["기1100-계"] = strToInt((string)item["inv_1100"]);
                workRow["외1320-계"] = strToInt((string)item["fgn_1320"]);
                workRow["기1320-계"] = strToInt((string)item["inv_1320"]);
                workRow["외1505-계"] = strToInt((string)item["fgn_1505"]);
                workRow["기1505-계"] = strToInt((string)item["inv_1505"]);

                workTable.Rows.Add(workRow);
                //}
            }

            dataGridView1.DataSource = workTable;
            dataGridView1.AutoResizeColumns();

            dataGridView1.Columns["외0920-계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["외0950-증감"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["외0950-계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["기0950-계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["0950-소계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["외1100-증감"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["외1100-계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["기1100-증감"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["기1100-계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["1100-소계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["외1320-증감"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["외1320-계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["기1320-증감"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["기1320-계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["1320-소계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["외1505-증감"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["외1505-계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["기1505-증감"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["기1505-계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns["1505-소계"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            dataGridView1.Columns["외0920-계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["외0950-증감"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["외0950-계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["기0950-계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["0950-소계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["외1100-증감"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["외1100-계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["기1100-증감"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["기1100-계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["1100-소계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["외1320-증감"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["외1320-계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["기1320-증감"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["기1320-계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["1320-소계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["외1505-증감"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["외1505-계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["기1505-증감"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["기1505-계"].DefaultCellStyle.Format = "N0";
            dataGridView1.Columns["1505-소계"].DefaultCellStyle.Format = "N0";
        }
Esempio n. 35
0
        /// <summary>
        /// 새 버전 체크
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void checkNewVersion_ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HttpRestClient client = new HttpRestClient("clientversion");
            if (!client.doWorkDialog())
            {
                client.showErrorDialog();
                return;
            }

            dynamic json = client.getJsonObject();
            if (json == null)
            {
                MessageBox.Show("전송 오류가 발생했습니다. (JSON 포맷오류)", "Format error!");
                return;
            }
            Console.WriteLine("statusCode: " + json["_metadata"]["statusCode"]);
            Console.WriteLine("version [" + json["clientversion"] + "]");
            Console.WriteLine("setup [" + json["clientsetup"] + "]");
            Console.WriteLine("md5 [" + json["clientmd5"] + "]");

            Version current = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            Version future = new Version((string)json["clientversion"]);

            if (current >= future)
            {
                if (!hiddenUpdateMessage)
                    MessageBox.Show("최신 버전을 사용하고 있습니다.", "버전 확인");
                hiddenUpdateMessage = false;
                return;
            }
            else
            {
                MessageBox.Show("새 버전이 있습니다. [" + future.ToString() + "]", "버전 확인");

                // 새 버전 자동 다운로드
                client = new HttpRestClient();
                client.RequestUri = (string)json["clientsetup"];
                if (!client.doWorkDialog())
                {
                    MessageBox.Show("다운로드 오류: " + client.ResponseMessage, "Request error!");
                    return;
                }

                string md5value = "";
                using (MD5 md5sum = MD5.Create())
                {
                    byte[] hashValue = md5sum.ComputeHash(client.ResponseContent);
                    for (int i = 0; i < hashValue.Length; i++)
                    {
                        md5value += hashValue[i].ToString("x2");
                    }
                }
                if (!md5value.Equals((string)json["clientmd5"]))
                {
                    MessageBox.Show("다운로드 파일 오류입니다. (md5 불일치)", "버전 확인");
                    return;
                }

                // 다운로드한 파일을 저장
                string localFileName = AppDomain.CurrentDomain.BaseDirectory + System.IO.Path.DirectorySeparatorChar + "Setup.exe";
                using (FileStream fs = File.Create(localFileName))
                {
                    fs.Write(client.ResponseContent, 0, client.ResponseContent.Length);
                }

                // 저장한 파일을 실행
                System.Diagnostics.Process.Start(localFileName);

                // 현재 프로그램을 종료
                exit_ToolStripMenuItem_Click(sender, e);
            }
        }
Esempio n. 36
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (isRegistered)
            {
                MessageBox.Show("이미 등록했습니다.", "Error");
                return;
            }

            if (!isParsed)
            {
                MessageBox.Show("미분석 파일입니다.", "Error");
                return;
            }

            if (this.listDataTypes.SelectedIndex < 0)
            {
                MessageBox.Show("자료 종류를 선택하지 않았습니다.", "Error");
                return;
            }

            if (this.listDataTimes.SelectedIndex < 0)
            {
                MessageBox.Show("시간을 선택하지 않았습니다.", "Error");
                return;
            }

            // 자료 종류
            MasterList selectedMaster = (MasterList)this.listDataTypes.SelectedItem;
            string dataTypeName = selectedMaster.name;
            int dataTypeId = selectedMaster.id;

            // 자료 시간
            string dataTime = (string)this.listDataTimes.SelectedValue;

            // 자료일자
            DateTime d = this.datePicker.Value;
            string dataDate = d.ToString("yyyyMMdd");

            Console.WriteLine("자료종류: " + dataTypeId + ":" + dataTypeName);
            Console.WriteLine("자료일자: " + dataDate);
            Console.WriteLine("자료시간: " + dataTime);

            // 자료 등록 처리
            // 등록URL: data/<자료종류>/<자료일자>/<자료시간>
            string resource_value = dataTypeId + "/" + dataDate + "/" + dataTime;
            HttpRestClient client = new HttpRestClient(HttpRestClient.REST_METHOD_CREATE, "data/" + resource_value);

            client.RequestDataFormat = HttpRestClient.DATA_FORMAT_JSON;
            string jsonStr = JsonConvert.SerializeObject(samFileParser.DataItems);
            client.RequestContent = Encoding.UTF8.GetBytes(jsonStr);

            // -------------------------------------------
            //Console.WriteLine(jsonStr);
            //File.WriteAllText("json.txt", jsonStr);

            if (!client.doWorkDialog())
            {
                client.showErrorDialog();
                return;
            }

            dynamic json = client.getJsonObject();
            if (json == null)
            {
                MessageBox.Show("전송 오류가 발생했습니다. (Can't convert json)", "Format error!");
                return;
            }
            Console.WriteLine("statusCode: " + json["_metadata"]["statusCode"]);

            if (json["FieldNotFound"] != null && ((string)json["FieldNotFound"]).Length > 0)
            {
                MessageBox.Show("다음 항목은 미등록 항목으로 저장하지 않았습니다.\n" + ((string)json["FieldNotFound"]), "주의");
            }

            //json["ErrorData"];

            if ((int)json["Rows"] == 0)
                MessageBox.Show("등록 건수가 없습니다. 중복여부를 확인하세요.", "등록오류");
            else
                MessageBox.Show(((string)json["Rows"]) + "건 등록이 완료되었습니다.", "등록완료");

            isRegistered = true;
        }