private void StartProduceBtn_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Confirm Start?"); if (result.Equals(MessageBoxResult.OK)) { try { OrderService s = new OrderService(); Msg<string> msg = s.GetOrderItemForProduce(orderItem.Id,mirror); if (msg.Result) { if (OrderItemFile.WirteToFile(orderItem.FileName, msg.Object)) { if (OrderDDSConverter.ConvertJsonOrderToDDS(orderItem.FileName)) { MessageBox.Show("Order Created, Please Use EASY to work!"); s.SetOrderItemTool(orderItem.ItemNr,currentTool1,currentTool2); this.Close(); } } } else { MessageBox.Show(msg.Content); } } catch (Exception ex) { MessageBox.Show(ex.Message); LogUtil.Logger.Error(ex.Message); } } }
public Msg <string> ReceiveOrder() { Msg <string> msg = new Msg <string>(); try { string postJson = string.Empty; using (var reader = OperationContext.Current.RequestContext.RequestMessage.GetReaderAtBodyContents()) { if (reader.Read()) { postJson = new string(Encoding.UTF8.GetChars(reader.ReadContentAsBase64())); LogUtil.Logger.Info("【RECEIVE】 ORDER"); LogUtil.Logger.Info(HttpUtility.UrlDecode(postJson.Split('=')[1])); JObject o = JObject.Parse(HttpUtility.UrlDecode(postJson.Split('=')[1])); Dictionary <string, object> v = o.ToObject <Dictionary <string, object> >(); OrderItemFile order = new OrderItemFile() { OrderNr = v["order_nr"].ToString(), ItemNr = v["item_nr"].ToString(), FileName = v["file_name"].ToString(), FileContent = v["file_json_content"].ToString() }; msg.Result = order.WriteToFile(); } } } catch (Exception e) { msg.Result = false; msg.Content = e.Message; LogUtil.Logger.Error(e.Message); } return(msg); }