Esempio n. 1
0
        public static void SaveBaseVehicleAppData(string connectionString)
        {
            using (var context = new AutoCareDataContext(connectionString))
            {
                var appData = context.CKDownloadedVariant.OrderBy(I => I.ProductID).ThenBy(I => I.VariantID).ThenBy(I => I.SubModel).ToList();
                foreach (var a in appData)
                {
                    context.CKDownloadedVariant.Attach(a);

                    var baseVehicleId =
                        CallService(
                            $"http://api.coverking.com/getData.asmx/GetSubmodel?Productid={a.ProductID}&Year={a.From_Year}&Make={a.Make_Descr}&Model={a.Model_Descr}",
                            "//ns:Submodel_table/ns:Basevehicle");
                    a.BaseVehicleID = baseVehicleId;

                    if (baseVehicleId != null)
                    {
                        var recID =
                            CallService(
                                $"http://api.coverking.com/getData.asmx/Get_options_gen?Basevehicle={baseVehicleId}&Productid={a.ProductID}&Submodel=&Customer_IP=223.223.154.114&DealerID=ACG92",
                                "//ns:ArrayOfOptions/ns:Options/ns:recid");
                        a.RecID = recID;
                        context.Entry(a).Property(I => I.RecID).IsModified = true;
                    }
                    context.Entry(a).Property(I => I.BaseVehicleID).IsModified = true;
                }
                context.SaveChanges();
            }
        }
Esempio n. 2
0
 public static void UpdateOrderStatus(string connectionString, List <order_tracking> trackingList)
 {
     using (var context = new AutoCareDataContext(connectionString))
     {
         foreach (var tracking in trackingList)
         {
             context.Entry(tracking).State = EntityState.Modified;
             context.OrderTracking.Attach(entity: tracking);
             tracking.processed = 1;
             context.Entry(tracking).Property(I => I.processed).IsModified = true;
         }
         context.SaveChanges();
     }
 }
Esempio n. 3
0
 public static void SaveProductOnJobber(string connectionString)
 {
     using (var context = new AutoCareDataContext(connectionString))
     {
         var products = context.CKProductMaster.ToList();
         foreach (var p in products)
         {
             var jobbers = context.CKDownloadedItem.Where(I => I.ItemID.StartsWith(p.product_id) && I.Product_Family_ID == p.product_family_id).ToList();
             if (jobbers.Count > 0)
             {
                 foreach (var jobber in jobbers)
                 {
                     context.CKDownloadedItem.Attach(jobber);
                     jobber.ProductID  = p.product_id;
                     jobber.MaterialID = jobber.ItemID.Replace(p.product_id, "");
                     context.Entry(jobber).Property(I => I.ProductID).IsModified  = true;
                     context.Entry(jobber).Property(I => I.MaterialID).IsModified = true;
                 }
             }
         }
         context.SaveChanges();
     }
 }