public Dokumen(Context.Dokumen dbitem) { Id = dbitem.Id; IdSalesOrder = dbitem.IdSO; if (dbitem.SalesOrder.SalesOrderOncallId.HasValue) { ModelOncall = new SalesOrderOncall(dbitem.SalesOrder); } else if (dbitem.SalesOrder.SalesOrderPickupId.HasValue) { ModelPickup = new SalesOrderPickup(dbitem.SalesOrder); } else if (dbitem.SalesOrder.SalesOrderProsesKonsolidasiId.HasValue) { ModelKonsolidasi = new SalesOrderProsesKonsolidasi(dbitem.SalesOrder); } else if (dbitem.SalesOrder.SalesOrderKontrakId.HasValue) { List <int> ListIdDumy = dbitem.ListIdSo.Split(new string[] { "." }, StringSplitOptions.None).ToList().Select(int.Parse).ToList(); List <Context.SalesOrderKontrakListSo> dbsoDummy = dbitem.SalesOrder.SalesOrderKontrak.SalesOrderKontrakListSo.Where(d => ListIdDumy.Contains(d.Id)).ToList(); dbitem.SalesOrder.SalesOrderKontrak.SalesOrderKontrakListSo = dbsoDummy; ModelKontrak = new SalesOrderKontrak(dbitem.SalesOrder); ModelKontrak.ListValueModelSOKontrak = ModelKontrak.ListModelSOKontrak; } ListDokumen = new List <DokumenItem>(); foreach (var item in dbitem.DokumenItem) { ListDokumen.Add(new DokumenItem(item)); } ListHistory = new List <DokumenItem>(); foreach (var item in dbitem.DokumenItemHistory) { ListHistory.Add(new DokumenItem(item)); } ListIdSo = dbitem.ListIdSo; IsComplete = dbitem.IsComplete; ModifiedDate = dbitem.ModifiedDate; IsAdmin = dbitem.IsAdmin; }
public SettlementReg(Context.SettlementReguler dbitem, List <Context.Atm> listAtm) { Id = dbitem.Id; IdSalesOrder = dbitem.IdSalesOrder; Code = dbitem.Code; if (dbitem.SalesOrder.SalesOrderOncallId.HasValue) { ModelOncall = new SalesOrderOncall(dbitem.SalesOrder); } else if (dbitem.SalesOrder.SalesOrderPickupId.HasValue) { ModelPickup = new SalesOrderPickup(dbitem.SalesOrder); } else if (dbitem.SalesOrder.SalesOrderProsesKonsolidasiId.HasValue) { ModelKonsolidasi = new SalesOrderProsesKonsolidasi(dbitem.SalesOrder); } else if (dbitem.SalesOrder.SalesOrderKontrakId.HasValue) { ModelKontrak = new SalesOrderKontrak(dbitem.SalesOrder); } KasDiterima = dbitem.KasDiterima; TransferDiterima = dbitem.TransferDiterima; SolarDiterima = dbitem.SolarDiterima; KapalDiterima = dbitem.KapalDiterima; KeteranganDiterima = dbitem.KeteranganDiterima; KasDiakui = dbitem.KasDiakui; TransferDiakui = dbitem.TransferDiakui; SolarDiakui = dbitem.SolarDiakui; KapalDiakui = dbitem.KapalDiakui; KeteranganDiakui = dbitem.KeteranganDiakui; KasKembali = dbitem.KasKembali; TransferKembali = dbitem.TransferKembali; SolarKembali = dbitem.SolarKembali; KapalKembali = dbitem.KapalKembali; KeteranganKembali = dbitem.KeteranganKembali; KasAktual = dbitem.KasAktual; TransferAktual = dbitem.TransferAktual; SolarAktual = dbitem.SolarAktual; KapalAktual = dbitem.KapalAktual; KeteranganAktual = dbitem.KeteranganAktual; KasSelisih = dbitem.KasSelisih; TransferSelisih = dbitem.TransferSelisih; SolarSelisih = dbitem.SolarSelisih; KapalSelisih = dbitem.KapalSelisih; KeteranganSelisih = dbitem.KeteranganSelisih; ListBiayaTambahan = new List <SettlementRegTambahanBiaya>(); foreach (var item in dbitem.SettlementRegulerTambahanBiaya) { ListBiayaTambahan.Add(new SettlementRegTambahanBiaya(item)); } TotalCash = dbitem.TotalCash; TanggalCash = dbitem.TanggalCash; IdDriverTujuan = dbitem.IdDriverTujuan; if (dbitem.IdDriverTujuan.HasValue) { NamaDriverTujuan = dbitem.DriverTujuan.KodeDriver + " - " + dbitem.DriverTujuan.NamaDriver; } IdDriverTitip = dbitem.IdDriverTitip; if (dbitem.IdDriverTitip.HasValue) { NamaDriverTitip = dbitem.DriverTitip.KodeDriver + " - " + dbitem.DriverTitip.NamaDriver; } TotalTf = dbitem.TotalTf; TanggalTf = dbitem.TanggalTf; if (dbitem.IdAtm.HasValue) { IdAtm = dbitem.IdAtm; NoRekening = dbitem.Atm.NoRekening; AtasNamaRek = dbitem.Atm.AtasNama; Bank = dbitem.Atm.LookupCodeBank.Nama; } else { //Context.Atm dbattm = listAtm.Where(d => d.IdDriver == dbitem.SalesOrder.AdminUangJalan.IdDriver1).FirstOrDefault(); //if (dbattm != null) //{ // IdAtm = dbattm.Id; // NoRekening = dbattm.NoRekening; // AtasNamaRek = dbattm.AtasNama; // Bank = dbattm.LookupCodeBank.Nama; //} } KeteranganPembayaran = dbitem.KeteranganPembayaran; listIdSoKontrak = dbitem.LisSoKontrak; TotalBayar = dbitem.TotalBayar; }