public PlanFact_All() { r = new PlanFact(); e = new PlanFact_Err(); using (var context = new CMER_DWEnt()) { Dic_Kpved = context.Dic_Kpved.Take(10).ToList<Dic_Kpved>(); Dic_Mkee = context.Dic_Mkee.Take(10).ToList<Dic_Mkee>(); Dic_Kato = context.Dic_Kato.Take(10).ToList<Dic_Kato>(); Dic_ContragentsCl = new List<CMER.Dic_ContragentsCl>(); //context.Dic_ContragentsCl.ToList<Dic_ContragentsCl>(); Dic_Source = context.Dic_Source.Take(10).ToList<Dic_Source>(); Dic_TypePlanFact = context.Dic_TypePlanFact.Take(10).ToList<Dic_TypePlanFact>(); Dic_Skp = context.Dic_Skp.Take(10).ToList<Dic_Skp>(); Dic_Certificates = context.Dic_Certificates.Take(10).ToList<Dic_Certificates>(); Dic_Ens = context.Dic_Ens.Take(10).ToList<Dic_Ens>(); Dic_Tnved = context.Dic_Tnved.Take(10).ToList<Dic_Tnved>(); Dic_CertificatesDetail = context.Dic_CertificatesDetail.Take(10).ToList<Dic_CertificatesDetail>(); Dic_Countries = context.Dic_Countries.Take(10).ToList<Dic_Countries>(); } }
public static List<PlanFact> PlanFactErrToPlanFact(List<PlanFact_Err> PFErrList) { List<PlanFact> PFList = new List<PlanFact>(); foreach (PlanFact_Err item in PFErrList) { PlanFact PF = new PlanFact(); PF.Name = item.Name; //PF.Qty = item.Qty PF.IDFact = item.IDFact; } return PFList; }
public static PlanFact Update(PlanFact model) { using (var context = new CMER_DWEnt()) { var m = context.PlanFact.SingleOrDefault(x => x.IDFact == model.IDFact); if (m == null) return model; m.Qty = model.Qty ?? m.Qty; m.Volume = model.Volume ?? m.Volume; m.IDKatoDelivery = model.IDKatoDelivery ?? m.IDKatoDelivery; m.IDKatoPurchaser = model.IDKatoPurchaser ?? m.IDKatoPurchaser; m.IDKatoSupplier = model.IDKatoSupplier ?? m.IDKatoSupplier; m.IDMkee = model.IDMkee ?? m.IDMkee; m.IDKpved = model.IDKpved ?? m.IDKpved; //context.SaveChanges(); return m; } }