Exemplo n.º 1
0
        public static StockoutPlan addStockoutPlan(StockoutPlanData item)
        {
            var client  = new RestClient(Properties.Settings.Default.apiEndPoint);
            var request = new RestRequest(Properties.Settings.Default.stockoutPlansPath, Method.POST);
            var json    = JsonConvert.SerializeObject(item);

            request.AddParameter("application/json; charset=utf-8", json, ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);  // Execute the Request

            return(JsonConvert.DeserializeObject <StockoutPlan>(response.Content));
        }
Exemplo n.º 2
0
 public static void doStockout(GridView grid, string table, string note, string poNumber, string store)
 {
     try
     {
         if (poNumber.Contains("KHX"))
         {
             StockoutPlanData data = getPlan(poNumber);
             poNumber = data.poNumber;
         }
         Model.StockoutReceipt stockoutReceipt = addStockoutReceipt(new Model.StockoutReceiptData
         {
             note      = note,
             poNumber  = poNumber,
             store     = store,
             isDeleted = false
         });
         List <Model.ReceiptDetail> item = new List <Model.ReceiptDetail>();
         for (int i = 0; i < grid.RowCount; i++)
         {
             Model.ReceiptDetail plan = grid.GetRow(i) as Model.ReceiptDetail;
             item.Add(new Model.ReceiptDetail
             {
                 id         = null,
                 currency   = plan.currency,
                 partName   = plan.partName,
                 partNumber = plan.partName,
                 receiptID  = stockoutReceipt.data.receiptID,
                 position   = plan.position,
                 price      = plan.price,
                 quantity   = plan.quantity,
                 unit       = plan.unit,
                 createdAt  = null,
                 updatedAt  = null,
             });
         }
         addReceiptDetail(item, table);
         MessageBox.Show("Thêm thành công");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }