public DataBorongan(Context.DataBorongan dbitem) { Id = dbitem.Id; IsTambahan = dbitem.IsTambahan; IdMasterPool = dbitem.IdMasterPool; StrMasterPool = dbitem.IdMasterPool.HasValue ? dbitem.MasterPool.NamePool : ""; IdJenisTruck = dbitem.IdJenisTruck; StrJenisTruck = dbitem.IdJenisTruck.HasValue ? dbitem.JenisTrucks.StrJenisTruck : ""; NamaBorongan = dbitem.NamaBorongan; Jarak = dbitem.Jarak; CustomerId = dbitem.CustomerId; CustomerName = dbitem.CustomerId == null ? "" : dbitem.Customer.CustomerNama; Rasio = dbitem.Rasio; LiterSolar = dbitem.LiterSolar; HargaSolar = dbitem.HargaSolar; WaktuHariKerja = dbitem.WaktuHariKerja; JumlahMakan = dbitem.JumlahMakan; AreaUangMakan = dbitem.AreaUangMakan; UangMakan = dbitem.UangMakan; BiayaTol = dbitem.BiayaTol; BobotTipsParkir = dbitem.BobotTipsParkir; TipsParkir = dbitem.TipsParkir; BobotGaji1 = dbitem.BobotGaji1; gaji1 = dbitem.gaji1; BobotGaji2 = dbitem.BobotGaji2; gaji2 = dbitem.gaji2; TotalGaji = dbitem.TotalGaji; Kapal = dbitem.Kapal; BiayaKapal = dbitem.BiayaKapal; BoronganDasar = dbitem.BoronganDasar; Kawalan = dbitem.Kawalan; Timbangan = dbitem.Timbangan; Karantina = dbitem.Karantina; SPSI = dbitem.SPSI; MultiDrop = dbitem.MultiDrop; TotalBorongan = dbitem.TotalBorongan; Pembulatan = dbitem.Pembulatan; listRuteBorongan = new List <DataBoronganRute>(); foreach (Context.DataBoronganRute item in dbitem.DataBoronganRute) { listRuteBorongan.Add(new DataBoronganRute() { Id = item.IdRute.Value, Nama = item.Rute.Nama, Dari = item.Rute.LocationAsal.Nama, Tujuan = item.Rute.LocationTujuan.Nama, MultiDrop = item.Rute.Multidrop == null ? "" : item.Rute.Multidrop.tujuan }); } AlokasiCash = dbitem.AlokasiCash; TotalAlokasiPembulatan = dbitem.TotalAlokasiPembulatan; }
public void SetDb(Context.DataBorongan dbitem) { dbitem.IsTambahan = IsTambahan; dbitem.IdMasterPool = IdMasterPool; dbitem.IdJenisTruck = IdJenisTruck; dbitem.NamaBorongan = NamaBorongan; dbitem.Jarak = Jarak; dbitem.CustomerId = CustomerId; dbitem.Rasio = Rasio; dbitem.LiterSolar = LiterSolar; dbitem.HargaSolar = HargaSolar.HasValue ? HargaSolar.Value : 0; dbitem.WaktuHariKerja = WaktuHariKerja; dbitem.JumlahMakan = JumlahMakan; dbitem.AreaUangMakan = AreaUangMakan; dbitem.UangMakan = UangMakan.HasValue ? UangMakan.Value : 0; dbitem.BiayaTol = BiayaTol.HasValue ? BiayaTol.Value : 0; dbitem.BobotTipsParkir = BobotTipsParkir; dbitem.TipsParkir = TipsParkir.HasValue ? TipsParkir.Value : 0; dbitem.BobotGaji1 = BobotGaji1; dbitem.gaji1 = gaji1.HasValue ? gaji1.Value : 0; dbitem.BobotGaji2 = BobotGaji2; dbitem.gaji2 = gaji2.HasValue ? gaji1.Value : 0; dbitem.TotalGaji = TotalGaji.HasValue ? TotalGaji.Value : 0; dbitem.Kapal = Kapal; dbitem.BiayaKapal = BiayaKapal.HasValue ? BiayaKapal.Value : 0; dbitem.BoronganDasar = BoronganDasar; dbitem.Kawalan = Kawalan; dbitem.Timbangan = Timbangan; dbitem.Karantina = Karantina; dbitem.SPSI = SPSI.HasValue ? SPSI.Value : 0; dbitem.MultiDrop = MultiDrop; dbitem.TotalBorongan = TotalBorongan.HasValue ? TotalBorongan.Value : 0; dbitem.Pembulatan = Pembulatan.HasValue ? Pembulatan.Value : 0; dbitem.DataBoronganRute.Clear(); if (JsonIdRute != "" && JsonIdRute != null) { foreach (string i in JsonIdRute.Split(',')) { dbitem.DataBoronganRute.Add(new Context.DataBoronganRute() { IdRute = int.Parse(i) }); } } dbitem.DataBoronganSPBU.Clear(); foreach (DataBoronganSPBU item in listSpbuBorongan.Where(d => d.IdSPBU != 0 && d.IdSPBU.HasValue)) { dbitem.DataBoronganSPBU.Add(new Context.DataBoronganSPBU() { IdLookupCodeSpbu = item.IdSPBU, value = item.value }); } dbitem.DataBoronganKapal.Clear(); foreach (DataBoronganKapal item in listKapalBorongan.Where(d => d.IdKapal != 0 && d.IdKapal.HasValue)) { dbitem.DataBoronganKapal.Add(new Context.DataBoronganKapal() { IdLookupCodeKapal = item.IdKapal, value = item.value }); } dbitem.DataBoronganTf.Clear(); foreach (DataBoronganTf item in listTfBorongan) { dbitem.DataBoronganTf.Add(new Context.DataBoronganTf() { value = item.value, LeadTime = item.LeadTime }); } dbitem.AlokasiCash = AlokasiCash; dbitem.TotalAlokasiPembulatan = TotalAlokasiPembulatan; }