コード例 #1
0
        public void Save(MasterPetugasDto Dto)
        {
            var Db = AutoMapper.Mapper.Map <master_petugas>(Dto);

            Uow = new UnitOfWorks();
            _masterPetugasRepo = Uow.GetGenericRepository <master_petugas>();

            _masterPetugasRepo.InsertOrUpdate(Db);
            Uow.SaveChanges();
        }
コード例 #2
0
        public void Save(MasterTransportDto Dto)
        {
            var Db = AutoMapper.Mapper.Map <master_transport>(Dto);

            Uow             = new UnitOfWorks();
            _masterItemRepo = Uow.GetGenericRepository <master_transport>();

            _masterItemRepo.InsertOrUpdate(Db);
            Uow.SaveChanges();
        }
コード例 #3
0
        public void Save(TRNBongkarMuatDto item)
        {
            trn_bongkar_muat model;

            if (item == null)
            {
                throw new Exception("Invalid Data Entry");
            }
            try
            {
                if (item.ID > 0)
                {
                    //update
                    model = _trnBongkarMuatRepo.Get(c => c.ID == item.ID).FirstOrDefault();

                    if (model == null)
                    {
                        throw new Exception("Data Not Found");
                    }

                    var oriDto = Mapper.Map <TRNBongkarMuatDto>(model);
                }
                var dbTrnBongkarMuat = Mapper.Map <trn_bongkar_muat>(item);

                model = Mapper.Map <trn_bongkar_muat>(item);
                var modelItem = model.trn_bongkat_muat_details_pekerja.ToList();

                try
                {
                    model.master_item      = null;
                    model.master_supplier  = null;
                    model.master_transport = null;
                    model.trn_bongkat_muat_details_pekerja = null;
                    _trnBongkarMuatRepo.InsertOrUpdate(model);

                    DeleteTrnBongkarMuatDetails(item.ID);
                    foreach (var TrnBongkarMuatDetailsItem in modelItem)
                    {
                        TrnBongkarMuatDetailsItem.ID_TRN_BONGKAR_MUAT = model.ID;
                        _trnBongkarMuatDetailsPekerjaRepo.InsertOrUpdate(TrnBongkarMuatDetailsItem);
                    }
                    Uow.SaveChanges();
                }
                catch (Exception exp)
                {
                    throw exp;
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }