private void gridView_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) { if (0 > e.RowHandle && sender.GetType() != typeof(GridView)) { return; } DataRow dr = gridView.GetDataRow(e.RowHandle); if (null != dr && dr.Table.Columns.Contains("state_cd")) { try { int state_cd = KnUtil.parseInt32(dr["state_cd"].ToString()); Color row_color = ObjOrder.getStateColor(state_cd); // 색상 적용 if (row_color != Color.Empty) { e.Appearance.BackColor = row_color; } } catch (Exception ex) { TsLog.writeLog(ex.Message); } } }
private void gridView_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) { if (0 > e.RowHandle && sender.GetType() != typeof(GridView)) { return; } DataRow dr = gridView.GetDataRow(e.RowHandle); if (null != dr && dr.Table.Columns.Contains("display_index")) { try { // 색상 적용 int display_index = KnUtil.parseInt32(dr["display_index"].ToString()); if (0 == (display_index % 2)) { e.Appearance.BackColor = Color.FromArgb(253, 253, 253); } } catch (Exception ex) { TsLog.writeLog(ex.Message); } } }
public bool loadFromDB(String _order_num) { // 초기화 initObj(); // 읽어오기 try { //using (ModelDBServer.MyDbConnection my_db = ModelDBServer.getConnection()) //{ // if (my_db.openDB()) // { // my_db.addParameter("@_login_key", AppMain.AppCore.Instance.getLoginUserLoginKey()); // my_db.addParameter("@_order_num", _order_num); // { // DataTable result_dt = my_db.execDatatableProcedure("ccp_Order_ObjLoad"); // if ((null != result_dt) && (0 < result_dt.Rows.Count)) // { // setObj(result_dt.Rows[0]); // Debug.Assert(_order_num == this.m_order_num); // } // } // } //} } catch (Exception ex) { TsLog.writeLog(ex.Message); } // 결과 return(0 < this.m_order_num.Length); }
// -------------------------------------- // log public void writeLog(string _log) { if (null != TsLog.getInstance()) { TsLog.writeLog(_log); } }
public bool setObj(String _input_type, byte[] _recv_data_buf, int _recv_data_offset, int _recv_data_len, String _output_type) { try { m_order_input_type = _input_type; m_order_input_raw_data_len = _recv_data_len; if (0 < _recv_data_len) { m_order_input_raw_data_buf = new byte[_recv_data_len]; System.Array.Copy(_recv_data_buf, _recv_data_offset, m_order_input_raw_data_buf, 0, m_order_input_raw_data_buf.Length); } else { m_order_input_raw_data_buf = null; } m_print_output_type = _output_type; } catch (Exception err) { TsLog.writeLog(err.Message); return(false); } return(true); }
public bool setObj(DataRow _dr) { if (null == _dr) { return(false); } try { m_config_id = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "config_id")); m_is_use = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "is_use")); m_is_install = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "is_install")); m_input_type = KnUtil.getDataRowString(_dr, "input_type"); m_input_port_num = KnUtil.getDataRowString(_dr, "input_port_num"); m_input_port_baud = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "input_port_baud")); m_listen_port_num = KnUtil.getDataRowString(_dr, "listen_port_num"); m_listen_port_baud = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "listen_port_baud")); m_conn_print_port_num = KnUtil.getDataRowString(_dr, "conn_print_port_num"); } catch (Exception ex) { TsLog.writeLog(ex.Message); Debug.Assert(false); return(false); } return(true); }
public bool setObj(DataRow _dr) { if (null == _dr) { return(false); } try { // Order m_order_num = _dr["order_num"].ToString(); m_order_biz_date = KnUtil.parseInt32(_dr["order_biz_date"].ToString()); m_order_type = KnUtil.parseInt32(_dr["order_type"].ToString()); m_state_cd = KnUtil.parseInt32(_dr["state_cd"].ToString()); m_call_num = _dr["call_num"].ToString(); m_call_datetime = KnUtil.parseDateTime(_dr["call_datetime"].ToString()); m_date_1 = KnUtil.parseDateTime(KnUtil.getDataRowString(_dr, "date_1")); m_date_2 = KnUtil.parseDateTime(KnUtil.getDataRowString(_dr, "date_2")); m_date_3 = KnUtil.parseDateTime(KnUtil.getDataRowString(_dr, "date_3")); m_date_4 = KnUtil.parseDateTime(KnUtil.getDataRowString(_dr, "date_4")); m_date_5 = KnUtil.parseDateTime(KnUtil.getDataRowString(_dr, "date_5")); m_date_6 = KnUtil.parseDateTime(KnUtil.getDataRowString(_dr, "date_6")); m_date_7 = KnUtil.parseDateTime(KnUtil.getDataRowString(_dr, "date_7")); // Shop m_shop_name = KnUtil.getDataRowString(_dr, "shop_name"); m_shop_request_time = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "shop_request_time")); m_shop_request_option = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "shop_request_option")); m_shop_cost = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "shop_cost")); // Customer m_customer_name = KnUtil.getDataRowString(_dr, "customer_name"); m_customer_cost = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "customer_cost")); m_customer_additional_cost = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "customer_additional_cost")); m_customer_additional_cost_memo = KnUtil.getDataRowString(_dr, "customer_additional_cost_memo"); m_customer_pay_type_cd = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "customer_pay_type_cd")); m_customer_pay_type_memo = KnUtil.getDataRowString(_dr, "customer_pay_type_memo"); m_customer_request_option = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "customer_request_option")); m_customer_request_time = KnUtil.parseInt32(KnUtil.getDataRowString(_dr, "customer_request_time")); m_customer_request_memo = KnUtil.getDataRowString(_dr, "customer_request_memo"); // Locate Arv m_arv_locate_name = KnUtil.getDataRowString(_dr, "arv_locate_name"); m_arv_locate_address = KnUtil.getDataRowString(_dr, "arv_locate_address"); m_arv_locate_alternative_address = KnUtil.getDataRowString(_dr, "arv_locate_alternative_address"); m_arv_locate_memo = KnUtil.getDataRowString(_dr, "arv_locate_memo"); m_arv_person_tel_num = KnUtil.getDataRowString(_dr, "arv_person_tel_num"); m_arv_person_memo = KnUtil.getDataRowString(_dr, "arv_person_memo"); } catch (Exception ex) { TsLog.writeLog(ex.Message); return(false); } return(true); }
private void onDataReceivedListenPort(object sender, SerialDataReceivedEventArgs e) { this.Invoke(new MethodInvoker(delegate { printListenPortReceivedData("-------------------- recv start"); })); System.Array.Clear(m_listen_port_read_buf, 0, m_listen_port_read_buf.Length); m_listen_port_read_len = 0; int onetime_read_len = 0; while (m_listen_port.BytesToRead > 0) { onetime_read_len = ((m_listen_port_read_len + m_listen_port.BytesToRead) < m_listen_port_read_buf.Length ? m_listen_port.BytesToRead : (m_listen_port_read_buf.Length - m_listen_port_read_len)); m_listen_port.Read(m_listen_port_read_buf, m_listen_port_read_len, onetime_read_len); m_listen_port_read_len += onetime_read_len; } //String read_msg_0 = System.Text.Encoding.ASCII.GetString(m_listen_port_read_buf); //String read_msg_1 = System.Text.Encoding.UTF8.GetString(m_listen_port_read_buf); //String read_msg_2 = System.Text.Encoding.Unicode.GetString(m_listen_port_read_buf); //String read_msg_3 = System.Text.Encoding.UTF32.GetString(m_listen_port_read_buf); String read_msg = System.Text.Encoding.Default.GetString(m_listen_port_read_buf); // 운영체제에 맞는 코드 페이지 TsLog.writeLog(read_msg); // log this.Invoke(new MethodInvoker(delegate { printListenPortReceivedData(" >> read: " + m_listen_port_read_len.ToString()); })); this.Invoke(new MethodInvoker(delegate { printListenPortReceivedData("-------------------- recv end--"); })); //String read_data = m_listen_port.ReadExisting(); //this.Invoke(new MethodInvoker(delegate { printListenPortReceivedData(read_data); })); if (0 < m_listen_port_read_len) { // request save ObjPrinterSerialRawDataBuf input_raw_data = new ObjPrinterSerialRawDataBuf(); input_raw_data.setObj("test_input_type", m_listen_port_read_buf, 0, m_listen_port_read_len, "test_output_type"); input_raw_data.requestSendRowData(); // push to list lock (m_recv_raw_data_list_lock) { m_recv_raw_data_list.Add(input_raw_data); } // button enable this.Invoke(new MethodInvoker(delegate { setFormControlEnable(true); })); } }
private void gridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (gridView.FocusedRowHandle < 0 && sender.GetType() != typeof(GridView)) { return; } try { if (gridView.IsRowSelected(e.RowHandle) || gridView.FocusedRowHandle == e.RowHandle) { Rectangle bounds = e.Bounds; // rowInfo.Bounds; bounds.X -= 1; bounds.Width += 2; if (null == m_focus_pen) { m_focus_pen = new Pen(Brushes.OrangeRed, 2); } e.Graphics.DrawLine(m_focus_pen, new Point(bounds.X, bounds.Y), new Point(bounds.X + bounds.Width, bounds.Y)); e.Graphics.DrawLine(m_focus_pen, new Point(bounds.X, bounds.Y + bounds.Height), new Point(bounds.X + bounds.Width, bounds.Y + bounds.Height)); } switch (e.Column.FieldName) { case "display_index": { e.DisplayText = (gridControl.FocusedView.RowCount - e.RowHandle).ToString(); } break; case "state_cd": { //Debug.WriteLine("e.Column.FieldName : " + e.Column.FieldName); //Debug.WriteLine("ObjOrder.getStateString(state_cd) : " + ObjOrder.getStateString(state_cd)); int state_cd = (int)e.CellValue; string text = ObjOrder.getStateString(state_cd); Bitmap img = ObjOrder.getStateImage(state_cd); if (img != null) { Point pos = new Point(); pos.X = e.Bounds.Location.X + 2; pos.Y = e.Bounds.Location.Y + ((e.Bounds.Height - img.Height) / 2); e.Graphics.DrawImage(img, pos.X, pos.Y, img.Width, img.Height); int margin_x = img.Width + 4; Rectangle rect = new Rectangle(e.Bounds.X + margin_x, e.Bounds.Y, e.Bounds.Width - margin_x, e.Bounds.Height); e.Appearance.DrawString(e.Cache, text, rect); e.Handled = true; } } break; case "call_num": { e.DisplayText = ((null == e.CellValue || 8 > e.CellValue.ToString().Length) ? e.CellValue.ToString() : KnUtil.formatTelNumber(e.CellValue.ToString())); } break; } } catch (Exception ex) { String erro_msg = (null == ex.Message ? "error - OrderList_gridView_CustomDrawCell" : ex.Message); TsLog.writeLog(erro_msg); //Debug.Assert(false, erro_msg); } }
private void gridView_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { // row handle & sender check if (gridView.FocusedRowHandle < 0 && sender.GetType() != typeof(GridView)) { return; } try { switch (e.Column.FieldName) { case "order_type": { int order_type = ((null == e.Value || 0 == e.Value.ToString().Length) ? 0 : (int)e.Value); e.DisplayText = ObjOrder.getOrderTypeString(order_type); } break; case "call_datetime": { DateTime datetime = ((null == e.Value || 8 > e.Value.ToString().Length) ? DateTime.MinValue : (DateTime)e.Value); e.DisplayText = (DateTime.MinValue == datetime ? "" : datetime.ToString("MM-dd HH:mm")); } break; case "date_1": { DateTime datetime = ((null == e.Value || 8 > e.Value.ToString().Length) ? DateTime.MinValue : (DateTime)e.Value); e.DisplayText = (DateTime.MinValue == datetime ? "" : datetime.ToString("HH:mm")); } break; case "date_2": { DateTime datetime = ((null == e.Value || 8 > e.Value.ToString().Length) ? DateTime.MinValue : (DateTime)e.Value); e.DisplayText = (DateTime.MinValue == datetime ? "" : datetime.ToString("HH:mm")); } break; case "date_3": { DateTime datetime = ((null == e.Value || 8 > e.Value.ToString().Length) ? DateTime.MinValue : (DateTime)e.Value); e.DisplayText = (DateTime.MinValue == datetime ? "" : datetime.ToString("HH:mm")); } break; case "date_4": { DateTime datetime = ((null == e.Value || 8 > e.Value.ToString().Length) ? DateTime.MinValue : (DateTime)e.Value); e.DisplayText = (DateTime.MinValue == datetime ? "" : datetime.ToString("HH:mm")); } break; case "date_5": { DateTime datetime = ((null == e.Value || 8 > e.Value.ToString().Length) ? DateTime.MinValue : (DateTime)e.Value); e.DisplayText = (DateTime.MinValue == datetime ? "" : datetime.ToString("HH:mm")); } break; case "date_6": { DateTime datetime = ((null == e.Value || 8 > e.Value.ToString().Length) ? DateTime.MinValue : (DateTime)e.Value); e.DisplayText = (DateTime.MinValue == datetime ? "" : datetime.ToString("HH:mm")); } break; case "date_7": { DateTime datetime = ((null == e.Value || 8 > e.Value.ToString().Length) ? DateTime.MinValue : (DateTime)e.Value); e.DisplayText = (DateTime.MinValue == datetime ? "" : datetime.ToString("HH:mm")); } break; case "customer_pay_type_cd": { int customer_pay_type_cd = ((null == e.Value || 0 == e.Value.ToString().Length) ? 0 : (int)e.Value); e.DisplayText = ObjOrder.getCustPayTypeString(customer_pay_type_cd); } break; case "shop_cost": { e.DisplayText = ((null == e.Value || 0 == e.Value.ToString().Length) ? "" : KnUtil.formatMoney((int)e.Value)); } break; case "customer_cost": { e.DisplayText = ((null == e.Value || 0 == e.Value.ToString().Length) ? "" : KnUtil.formatMoney((int)e.Value)); } break; } } catch (Exception ex) { String erro_msg = (null == ex.Message ? "error - OrderList_gridView_CustomColumnDisplayText" : ex.Message); TsLog.writeLog(erro_msg); Debug.Assert(false, erro_msg); } }
public void onChangeObj(ObjOrder _obj, bool _is_change_state = false) { Utility.Utility.LogWrite("onChangeObj인자2개짜리"); try { // save Kons.ShopCallpass.AppMain.AppCore.Instance.getAppDoc().setObjOrder(_obj); // check visible if (!isShowOrder(_obj)) { return; } // control DataTable view_table = getGridViewDataSource(); if (null != view_table) { // 기존 객체 얻기 DataRow[] sel_rows = null; try { sel_rows = view_table.Select(String.Format("order_num = '{0}'", _obj.m_order_num)); } catch (Exception err) { TsLog.writeLog(err.Message); } // 기존 없으면 생성 if (null == sel_rows || 0 == sel_rows.Length) { sel_rows = new DataRow[1]; if (null != sel_rows) { sel_rows[0] = view_table.NewRow(); } view_table.Rows.InsertAt(sel_rows[0], 0); } else { if (!_is_change_state) { // 상태변경을 해야하는 경우(배달요청후)가 아니면 기존 상태를 안바뀌게 하기위해 아래 채우기전에 이전값으로 넣음 // 중복으로 연계 눌렀을경우 상태가 변경되는것을 막기위해 기본적으로 이전 상태를 유지한다. _obj.m_state_cd = KnUtil.parseInt32(sel_rows[0]["state_cd"].ToString()); } } // 새로 받은 내용 채우기 if (null != sel_rows[0]) { ObjOrder.setTableData(ref sel_rows[0], ref _obj); // obj -> data row } // 다시 그리기 redrawListControl(); } } catch (Exception ex) { Kons.ShopCallpass.AppMain.AppCore.detectException(ex.Message); } }
public ObjProcedureResult saveToDB(int _reg_count_idx = 0, int _reg_count_tot = 0) { ObjProcedureResult proc_result = new ObjProcedureResult(); try { //using (ModelDBServer.MyDbConnection my_db = ModelDBServer.getConnection()) //{ // if (my_db.openDB()) // { // my_db.addParameter("@_login_key", AppMain.AppCore.Instance.getLoginUserLoginKey()); // // order // my_db.addParameter("@_state_cd", m_state_cd); // my_db.addParameter("@_call_num", m_call_num); // my_db.addParameter("@_caller_line", m_caller_line); // my_db.addParameter("@_caller_id", m_caller_id); // my_db.addParameter("@_memo", m_memo); // // company // my_db.addParameter("@_company_id", m_company_id); // // shop // my_db.addParameter("@_shop_id", m_shop_id); // my_db.addParameter("@_shop_pay_type", m_shop_pay_type); // my_db.addParameter("@_shop_pay_step", m_shop_pay_step); // my_db.addParameter("@_shop_request_time", m_shop_request_time); // my_db.addParameter("@_shop_request_option", m_shop_request_option); // my_db.addParameter("@_shop_cost", m_shop_cost); // // customer // my_db.addParameter("@_customer_id", m_customer_id); // my_db.addParameter("@_customer_cost", m_customer_cost); // my_db.addParameter("@_customer_pay_type", m_customer_pay_type); // my_db.addParameter("@_customer_pay_step", m_customer_pay_step); // // driver // my_db.addParameter("@_driver_id", m_driver_id); // my_db.addParameter("@_driver_cost", m_driver_cost); // // locate dpt // my_db.addParameter("@_dpt_lev0_locate_code", m_dpt_lev0_locate_code); // my_db.addParameter("@_dpt_lev1_locate_code", m_dpt_lev1_locate_code); // my_db.addParameter("@_dpt_lev2_locate_code", m_dpt_lev2_locate_code); // my_db.addParameter("@_dpt_locate_crypt_x", m_dpt_locate_crypt_x); // my_db.addParameter("@_dpt_locate_crypt_y", m_dpt_locate_crypt_y); // my_db.addParameter("@_dpt_locate_name", m_dpt_locate_name); // my_db.addParameter("@_dpt_locate_address", m_dpt_locate_address); // my_db.addParameter("@_dpt_locate_memo", m_dpt_locate_memo); // my_db.addParameter("@_send_person_tel_num", m_send_person_tel_num); // my_db.addParameter("@_send_person_memo", m_send_person_memo); // // locate arv // my_db.addParameter("@_arv_lev0_locate_code", m_arv_lev0_locate_code); // my_db.addParameter("@_arv_lev1_locate_code", m_arv_lev1_locate_code); // my_db.addParameter("@_arv_lev2_locate_code", m_arv_lev2_locate_code); // my_db.addParameter("@_arv_locate_crypt_x", m_arv_locate_crypt_x); // my_db.addParameter("@_arv_locate_crypt_y", m_arv_locate_crypt_y); // my_db.addParameter("@_arv_locate_name", m_arv_locate_name); // my_db.addParameter("@_arv_locate_address", m_arv_locate_address); // my_db.addParameter("@_arv_locate_alternative_address", m_arv_locate_alternative_address); // my_db.addParameter("@_arv_locate_memo", m_arv_locate_memo); // my_db.addParameter("@_arv_person_tel_num", m_arv_person_tel_num); // my_db.addParameter("@_arv_person_memo", m_arv_person_memo); // // 복수콜 // my_db.addParameter("@_reg_count_idx", _reg_count_idx); // my_db.addParameter("@_reg_count_tot", _reg_count_tot); // DataTable result_dt = my_db.execDatatableProcedure("ccp_Order_ObjSave"); // if (!proc_result.setResult(result_dt)) // { // String err_msg = (null == my_db.getLastError() ? "fail. set result data: " : my_db.getLastError()); // Debug.Assert(false, err_msg); // } // } //} } catch (Exception ex) { TsLog.writeLog(ex.Message); } return(proc_result); }
static public void setTableData(ref DataRow _des_row, ref ObjOrder _obj_order) { Utility.Utility.LogWrite("setTableData"); // order 는 makeTableSchema 이후 ImportRow 통해서 넣는것이 아니라 한번에 넣기 때문에 // 프로시저에서 불러온 DataTable Schema 따라간다. // 그래서 setDataRowData 함수 이용해서 없는것은 체크해서 넣어야 한다. try { _des_row.BeginEdit(); // start edit { // Order _des_row["order_num"] = _obj_order.m_order_num; _des_row["order_biz_date"] = _obj_order.m_order_biz_date; _des_row["order_type"] = _obj_order.m_order_type; _des_row["state_cd"] = _obj_order.m_state_cd; _des_row["call_num"] = _obj_order.m_call_num; _des_row["call_datetime"] = _obj_order.m_call_datetime; _des_row["date_1"] = _obj_order.m_date_1; _des_row["date_2"] = _obj_order.m_date_2; _des_row["date_3"] = _obj_order.m_date_3; _des_row["date_4"] = _obj_order.m_date_4; _des_row["date_5"] = _obj_order.m_date_5; _des_row["date_6"] = _obj_order.m_date_6; _des_row["date_7"] = _obj_order.m_date_7; // Shop _des_row["shop_name"] = _obj_order.m_shop_name; _des_row["shop_request_time"] = _obj_order.m_shop_request_time; _des_row["shop_request_option"] = _obj_order.m_shop_request_option; _des_row["shop_cost"] = _obj_order.m_shop_cost; // Customer _des_row["customer_name"] = _obj_order.m_customer_name; _des_row["customer_cost"] = _obj_order.m_customer_cost; _des_row["customer_additional_cost"] = _obj_order.m_customer_additional_cost; _des_row["customer_additional_cost_memo"] = _obj_order.m_customer_additional_cost_memo; _des_row["customer_pay_type_cd"] = _obj_order.m_customer_pay_type_cd; _des_row["customer_pay_type_memo"] = _obj_order.m_customer_pay_type_memo; _des_row["customer_request_option"] = _obj_order.m_customer_request_option; _des_row["customer_request_time"] = _obj_order.m_customer_request_time; _des_row["customer_request_memo"] = _obj_order.m_customer_request_memo; // Locate Arv _des_row["arv_locate_name"] = _obj_order.m_arv_locate_name; _des_row["arv_locate_address"] = _obj_order.m_arv_locate_address; _des_row["arv_locate_alternative_address"] = _obj_order.m_arv_locate_alternative_address; _des_row["arv_locate_memo"] = _obj_order.m_arv_locate_memo; _des_row["arv_person_tel_num"] = _obj_order.m_arv_person_tel_num; _des_row["arv_person_memo"] = _obj_order.m_arv_person_memo; } } catch (Exception ex) { TsLog.writeLog(ex.Message); } finally { _des_row.EndEdit(); // end edit } }
public bool requestSendRowData() {// // head String uri = Kons.ShopCallpass.AppMain.AppCore.Instance.getWebRestUrl() + "/regOrderInputRawData.aspx"; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri); req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded; charset=utf-8"; req.Headers.Add("__ak", Kons.ShopCallpass.AppMain.AppCore.Instance.getAppKey()); req.Headers.Add("__av", Kons.ShopCallpass.AppMain.AppCore.Instance.getAppVersion().ToString()); req.Headers.Add("__lk", Kons.ShopCallpass.AppMain.AppCore.Instance.getLoginUserLoginKey()); req.Timeout = 9000; //req.KeepAlive = false; // prepare data byte[] order_input_type_buf = Encoding.UTF8.GetBytes(this.m_order_input_type); Int32 order_input_type_len = order_input_type_buf.Length; byte[] order_input_raw_data_buf = m_order_input_raw_data_buf; Int32 order_input_raw_data_len = m_order_input_raw_data_len; byte[] print_output_type_buf = Encoding.UTF8.GetBytes(this.m_print_output_type); Int32 print_output_type_len = print_output_type_buf.Length; // body byte[] send_body_data_buf = new byte[4 + order_input_type_len + 4 + order_input_raw_data_len + 4 + print_output_type_len]; int wLen = 0; try { using (MemoryStream ms = new MemoryStream(send_body_data_buf, 0, send_body_data_buf.Length)) { using (BinaryWriter bw = new BinaryWriter(ms, Encoding.Default)) { bw.Write(order_input_type_len); wLen += 4; bw.Write(order_input_type_buf, 0, order_input_type_len); wLen += order_input_type_len; bw.Write(order_input_raw_data_len); wLen += 4; bw.Write(order_input_raw_data_buf, 0, order_input_raw_data_len); wLen += order_input_raw_data_len; bw.Write(print_output_type_len); wLen += 4; bw.Write(print_output_type_buf, 0, print_output_type_len); wLen += print_output_type_len; } } } catch (Exception err) { TsLog.writeLog(err.Message); } // write body data on request stream String recv_result = ""; int recv_len = 0; try { req.ContentLength = (null == send_body_data_buf ? 0 : send_body_data_buf.Length); if (null != send_body_data_buf) { using (Stream stream_data = req.GetRequestStream()) { stream_data.Write(send_body_data_buf, 0, send_body_data_buf.Length); } } using (HttpWebResponse res = (HttpWebResponse)req.GetResponse()) { Stream stream = res.GetResponseStream(); Array.Clear(m_recv_buf, 0, m_recv_buf.Length); Byte[] buf = m_temp_buf; int read_len = 0; do { Array.Clear(buf, 0, buf.Length); read_len = stream.Read(buf, 0, buf.Length); if (read_len != 0) { Array.Copy(buf, 0, m_recv_buf, recv_len, read_len); recv_len += read_len; } } while (read_len > 0); // parsing to string recv_result = Encoding.UTF8.GetString(m_recv_buf, 0, recv_len); } } catch (Exception err) { TsLog.writeLog(err.Message); return(false); } return(true); }
public bool requestSendRowData() { // head String uri = Kons.ShopCallpass.AppMain.AppCore.Instance.getWebRestUrl() + "/regOrderInputRawData.aspx"; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri); req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded; charset=utf-8"; req.Headers.Add("__ak", Kons.ShopCallpass.AppMain.AppCore.Instance.getAppKey()); req.Headers.Add("__av", Kons.ShopCallpass.AppMain.AppCore.Instance.getAppVersion().ToString()); req.Headers.Add("__lk", Kons.ShopCallpass.AppMain.AppCore.Instance.getLoginUserLoginKey()); req.Timeout = 9000; //req.KeepAlive = false; // prepare data ParserOrderInputBase parser = (null == m_caller_serial_port ? null : m_caller_serial_port.getOrderParser()); String input_port_name = (null == parser ? "none" : ParserOrderInputBase.obtainParserName(parser.getParserType())); byte[] order_input_type_buf = Encoding.UTF8.GetBytes(input_port_name); Int32 order_input_type_len = order_input_type_buf.Length; byte[] order_input_raw_data_buf = this.m_data_buf; Int32 order_input_raw_data_len = this.m_data_len; Utility.Utility.LogWrite("서버 작업 부분 : " + Encoding.Default.GetString(this.m_data_buf)); Utility.Utility.LogWrite("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); String print_port_name = (null == m_caller_serial_port.getPrintOutputPortNum() ? "null" : m_caller_serial_port.getPrintOutputPortNum()); byte[] print_output_type_buf = Encoding.UTF8.GetBytes(print_port_name); Int32 print_output_type_len = print_output_type_buf.Length; // body byte[] send_body_data_buf = new byte[4 + order_input_type_len + 4 + order_input_raw_data_len + 4 + print_output_type_len]; int wLen = 0; try { using (MemoryStream ms = new MemoryStream(send_body_data_buf, 0, send_body_data_buf.Length)) { using (BinaryWriter bw = new BinaryWriter(ms, Encoding.Default)) { bw.Write(order_input_type_len); wLen += 4; bw.Write(order_input_type_buf, 0, order_input_type_len); wLen += order_input_type_len; bw.Write(order_input_raw_data_len); wLen += 4; bw.Write(order_input_raw_data_buf, 0, order_input_raw_data_len); wLen += order_input_raw_data_len; bw.Write(print_output_type_len); wLen += 4; bw.Write(print_output_type_buf, 0, print_output_type_len); wLen += print_output_type_len; } } } catch (Exception err) { TsLog.writeLog(err.Message); } // write body data on request stream //String recv_result = ""; //int recv_len = 0; try { req.ContentLength = (null == send_body_data_buf ? 0 : send_body_data_buf.Length); if (null != send_body_data_buf) { using (Stream stream_data = req.GetRequestStream()) { stream_data.Write(send_body_data_buf, 0, send_body_data_buf.Length); } } using (HttpWebResponse res = (HttpWebResponse)req.GetResponse()) { //Stream stream = res.GetResponseStream(); //Array.Clear(m_recv_buf, 0, m_recv_buf.Length); //Byte[] buf = m_temp_buf; //int read_len = 0; //do //{ // Array.Clear(buf, 0, buf.Length); // read_len = stream.Read(buf, 0, buf.Length); // if (read_len != 0) // { // Array.Copy(buf, 0, m_recv_buf, recv_len, read_len); // recv_len += read_len; // } //} while (read_len > 0); //// parsing to string //recv_result = Encoding.UTF8.GetString(m_recv_buf, 0, recv_len); } } catch (Exception err) { TsLog.writeLog(err.Message); return(false); } return(true); }