コード例 #1
0
ファイル: SaleSuspend.cs プロジェクト: Lincoln007/DotNet.ERP
 public static IEnumerable <IBarcode> Read(ShoppingCart cart, string id)
 {
     try
     {
         List <IBarcode> result   = null;
         var             fileName = string.Format("SaleDetails{0}.JSON", id);
         var             filePath = Path.Combine(MachinesSettings.CachePath, fileName);
         if (File.Exists(filePath))
         {
             using (StreamReader sr = new StreamReader(filePath))
             {
                 var json = sr.ReadToEnd();
                 result = JsonConvert.DeserializeObject <List <IBarcode> >(json, new BarcodeConverter());
             }
         }
         if (result != null && result.Count() > 0)
         {
             cart.Clear();
             cart.OrderList = result;
             cart.ResetProduct(SaleStatus.Normal);
         }
         var suspendList = SuspendList.Factory(cart.MachineInformation.StoreId, cart.MachineInformation.MachineSn, cart.MachineInformation.CompanyId, MachinesSettings.CachePath);
         suspendList.RemoveAll(o => o.Id == id);
         suspendList.Save(MachinesSettings.CachePath, cart.MachineInformation.StoreId, cart.MachineInformation.MachineSn, cart.MachineInformation.CompanyId);
         File.Delete(filePath);
         return(result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #2
0
ファイル: SaleSuspend.cs プロジェクト: Lincoln007/DotNet.ERP
 public static SuspendList Remove(ShoppingCart cart, string id)
 {
     try
     {
         var suspendList = SuspendList.Factory(cart.MachineInformation.StoreId, cart.MachineInformation.MachineSn, cart.MachineInformation.CompanyId, MachinesSettings.CachePath);
         var fileName    = string.Format("SaleDetails{0}.JSON", id);
         var filePath    = Path.Combine(MachinesSettings.CachePath, fileName);
         suspendList.RemoveAll(o => o.Id == id);
         suspendList.Save(MachinesSettings.CachePath, cart.MachineInformation.StoreId, cart.MachineInformation.MachineSn, cart.MachineInformation.CompanyId);
         File.Delete(filePath);
         return(suspendList);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #3
0
ファイル: SaleSuspend.cs プロジェクト: Lincoln007/DotNet.ERP
 public static void Suspend(ShoppingCart cart)
 {
     try
     {
         var statistics = cart.GetSaleStatistics();
         var details    = new SuspendDetails()
         {
             Id          = KeyFactory.SuspendKeyFactory(cart.MachineInformation.CompanyId, cart.MachineInformation.StoreId, cart.MachineInformation.MachineSn, cart.MachineInformation.DeviceSn),
             Amount      = statistics.Receivable,
             Count       = statistics.Num,
             SuspendDate = DateTime.Now,
             OrderSN     = cart.OrderSN
         };
         var suspendList = SuspendList.Factory(cart.MachineInformation.StoreId, cart.MachineInformation.MachineSn, cart.MachineInformation.CompanyId, MachinesSettings.CachePath);
         suspendList.Add(details);
         suspendList.Save(MachinesSettings.CachePath, cart.MachineInformation.StoreId, cart.MachineInformation.MachineSn, cart.MachineInformation.CompanyId);
         Save(cart, MachinesSettings.CachePath, details.Id);
         cart.Clear();
     }
     catch (Exception ex)
     {
         throw;
     }
 }