예제 #1
0
 public static StockinPlan addStockinPlan(StockinPlanData item)
 {
     try
     {
         var client  = new RestClient(Properties.Settings.Default.apiEndPoint);
         var request = new RestRequest(Properties.Settings.Default.stockinPlansPath, 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 <StockinPlan>(response.Content));
     }
     catch { return(new StockinPlan()); }
 }
예제 #2
0
        public static void doStockin(GridView grid, string table, string note, string quotationNumber, string store)
        {
            try
            {
                if (quotationNumber.Contains("KHN"))
                {
                    StockinPlanData data = getStockinPlan(quotationNumber);
                    quotationNumber = data.quotationNumber;
                }
                Model.StockinReceipt stockinPlan = addStockinReceipt(new Model.StockinReceiptData
                {
                    note            = note,
                    quotationNumber = quotationNumber
                    ,
                    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  = stockinPlan.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;
            }
        }