public override List <MIDAS.GBX.BusinessObjects.BusinessValidation> Validate <T>(T entity) { BO.InsuranceMaster insuranceMaster = (BO.InsuranceMaster)(object) entity; var result = insuranceMaster.Validate(insuranceMaster); return(result); }
public override Object Get(int id) { var acc = _context.InsuranceMasters.Include("addressInfo").Include("contactInfo") .Where(p => p.Id == id && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))) .FirstOrDefault(); if (acc == null) { return(new BO.ErrorObject { ErrorMessage = "No Insurance Master info found.", errorObject = "", ErrorLevel = ErrorLevel.Error }); } else { BO.InsuranceMaster acc_ = ObjectConvert <BO.InsuranceMaster, InsuranceMaster>(acc); return((object)acc_); } }
public override object GetInsuranceDetails(int id, int CompanyId) { var acc = _context.InsuranceMasters.Include("addressInfo").Include("contactInfo") .Where(p => p.Id == id && (p.CreatedByCompanyId.HasValue == false || (p.CreatedByCompanyId.HasValue == true && p.CreatedByCompanyId.Value == CompanyId)) && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))) .FirstOrDefault <InsuranceMaster>(); if (acc == null) { return(new BO.ErrorObject { ErrorMessage = "No record found for this Insurance Master Id.", errorObject = "", ErrorLevel = ErrorLevel.Error }); } else { BO.InsuranceMaster acc_ = ObjectConvert <BO.InsuranceMaster, InsuranceMaster>(acc); return((object)acc_); } }
public override object Save <T>(T entity) { BO.InsuranceMaster insuranceMasterBO = (BO.InsuranceMaster)(object) entity; BO.AddressInfo addressBO = insuranceMasterBO.AddressInfo; BO.ContactInfo contactinfoBO = insuranceMasterBO.ContactInfo; if (insuranceMasterBO.CreatedByCompanyId.HasValue == true) { InsuranceMaster insuranceMasterDB = new InsuranceMaster(); using (var dbContextTransaction = _context.Database.BeginTransaction()) { bool IsEditMode = false; IsEditMode = (insuranceMasterBO != null && insuranceMasterBO.ID > 0) ? true : false; AddressInfo addressDB = new AddressInfo(); ContactInfo contactinfoDB = new ContactInfo(); #region Address if (addressBO != null) { bool Add_addressDB = false; addressDB = _context.AddressInfoes.Where(p => p.id == addressBO.ID && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).FirstOrDefault(); if (addressDB == null && addressBO.ID <= 0) { addressDB = new AddressInfo(); Add_addressDB = true; } else if (addressDB == null && addressBO.ID > 0) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Address details dosent exists.", ErrorLevel = ErrorLevel.Error }); } addressDB.Name = IsEditMode == true && addressBO.Name == null ? addressDB.Name : addressBO.Name; addressDB.Address1 = IsEditMode == true && addressBO.Address1 == null ? addressDB.Address1 : addressBO.Address1; addressDB.Address2 = IsEditMode == true && addressBO.Address2 == null ? addressDB.Address2 : addressBO.Address2; addressDB.City = IsEditMode == true && addressBO.City == null ? addressDB.City : addressBO.City; addressDB.State = IsEditMode == true && addressBO.State == null ? addressDB.State : addressBO.State; addressDB.ZipCode = IsEditMode == true && addressBO.ZipCode == null ? addressDB.ZipCode : addressBO.ZipCode; addressDB.Country = IsEditMode == true && addressBO.Country == null ? addressDB.Country : addressBO.Country; //[STATECODE-CHANGE] //addressDB.StateCode = IsEditMode == true && addressBO.StateCode == null ? addressDB.StateCode : addressBO.StateCode; //[STATECODE-CHANGE] if (Add_addressDB == true) { addressDB = _context.AddressInfoes.Add(addressDB); } _context.SaveChanges(); } else { if (IsEditMode == false) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Please pass valid address details.", ErrorLevel = ErrorLevel.Error }); } addressDB = null; } #endregion #region Contact Info if (contactinfoBO != null) { bool Add_contactinfoDB = false; contactinfoDB = _context.ContactInfoes.Where(p => p.id == contactinfoBO.ID && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).FirstOrDefault(); if (contactinfoDB == null && contactinfoBO.ID <= 0) { contactinfoDB = new ContactInfo(); Add_contactinfoDB = true; } else if (contactinfoDB == null && contactinfoBO.ID > 0) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Contact details dosent exists.", ErrorLevel = ErrorLevel.Error }); } contactinfoDB.Name = IsEditMode == true && contactinfoBO.Name == null ? contactinfoDB.Name : contactinfoBO.Name; contactinfoDB.CellPhone = IsEditMode == true && contactinfoBO.CellPhone == null ? contactinfoDB.CellPhone : contactinfoBO.CellPhone; contactinfoDB.EmailAddress = IsEditMode == true && contactinfoBO.EmailAddress == null ? contactinfoDB.EmailAddress : contactinfoBO.EmailAddress; contactinfoDB.HomePhone = IsEditMode == true && contactinfoBO.HomePhone == null ? contactinfoDB.HomePhone : contactinfoBO.HomePhone; contactinfoDB.WorkPhone = IsEditMode == true && contactinfoBO.WorkPhone == null ? contactinfoDB.WorkPhone : contactinfoBO.WorkPhone; contactinfoDB.FaxNo = IsEditMode == true && contactinfoBO.FaxNo == null ? contactinfoDB.FaxNo : contactinfoBO.FaxNo; contactinfoDB.OfficeExtension = IsEditMode == true && contactinfoBO.OfficeExtension == null ? contactinfoDB.OfficeExtension : contactinfoBO.OfficeExtension; contactinfoDB.AlternateEmail = IsEditMode == true && contactinfoBO.AlternateEmail == null ? contactinfoDB.AlternateEmail : contactinfoBO.AlternateEmail; contactinfoDB.PreferredCommunication = IsEditMode == true && contactinfoBO.PreferredCommunication == null ? contactinfoDB.PreferredCommunication : contactinfoBO.PreferredCommunication; contactinfoDB.IsDeleted = contactinfoBO.IsDeleted; if (Add_contactinfoDB == true) { contactinfoDB = _context.ContactInfoes.Add(contactinfoDB); } _context.SaveChanges(); } else { if (IsEditMode == false) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Please pass valid contact details.", ErrorLevel = ErrorLevel.Error }); } contactinfoDB = null; } #endregion #region Insurance Master if (insuranceMasterBO != null) { bool Add_insuranceMasterDB = false; insuranceMasterDB = _context.InsuranceMasters.Where(p => p.Id == insuranceMasterBO.ID && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).FirstOrDefault <InsuranceMaster>(); if (insuranceMasterDB == null && insuranceMasterBO.ID <= 0) { insuranceMasterDB = new InsuranceMaster(); Add_insuranceMasterDB = true; } else if (insuranceMasterDB == null && insuranceMasterBO.ID > 0) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Insurance Master information dosent exists.", ErrorLevel = ErrorLevel.Error }); } insuranceMasterDB.CompanyCode = insuranceMasterBO.CompanyCode; insuranceMasterDB.CompanyName = IsEditMode == true && insuranceMasterBO.CompanyName == null ? insuranceMasterDB.CompanyName : insuranceMasterBO.CompanyName; insuranceMasterDB.ZeusID = insuranceMasterBO.ZeusID; insuranceMasterDB.PriorityBilling = insuranceMasterBO.PriorityBilling; insuranceMasterDB.Only1500Form = insuranceMasterBO.Only1500Form; insuranceMasterDB.PaperAuthorization = insuranceMasterBO.PaperAuthorization; insuranceMasterDB.CreatedByCompanyId = insuranceMasterBO.CreatedByCompanyId; insuranceMasterDB.AddressInfoId = (addressDB != null && addressDB.id > 0) ? addressDB.id : insuranceMasterDB.AddressInfoId; insuranceMasterDB.ContactInfoId = (contactinfoDB != null && contactinfoDB.id > 0) ? contactinfoDB.id : insuranceMasterDB.ContactInfoId; if (Add_insuranceMasterDB == true) { insuranceMasterDB = _context.InsuranceMasters.Add(insuranceMasterDB); } _context.SaveChanges(); } else { if (IsEditMode == false) { dbContextTransaction.Rollback(); return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Please pass valid insurance master information details.", ErrorLevel = ErrorLevel.Error }); } insuranceMasterDB = null; } _context.SaveChanges(); #endregion dbContextTransaction.Commit(); insuranceMasterDB = _context.InsuranceMasters.Include("addressInfo").Include("contactInfo").Where(p => p.Id == insuranceMasterDB.Id && (p.IsDeleted.HasValue == false || (p.IsDeleted.HasValue == true && p.IsDeleted.Value == false))).FirstOrDefault <InsuranceMaster>(); } var res = ObjectConvert <BO.InsuranceMaster, InsuranceMaster>(insuranceMasterDB); return((object)res); } else { return(new BO.ErrorObject { errorObject = "", ErrorMessage = "Cannot add or update Master Insurance data.", ErrorLevel = ErrorLevel.Error }); } }
public override T Convert <T, U>(U entity) { List <InsuranceMaster> insuranceMaster = entity as List <InsuranceMaster>; if (insuranceMaster == null) { return(default(T)); } List <BO.InsuranceMaster> boInsuranceMasters = new List <BO.InsuranceMaster>(); foreach (var eachInsuranceMaster in insuranceMaster) { BO.InsuranceMaster boInsuranceMaster = new BO.InsuranceMaster(); boInsuranceMaster.ID = eachInsuranceMaster.Id; boInsuranceMaster.CompanyCode = eachInsuranceMaster.CompanyCode; boInsuranceMaster.CompanyName = eachInsuranceMaster.CompanyName; boInsuranceMaster.AddressInfoId = eachInsuranceMaster.AddressInfoId; boInsuranceMaster.ContactInfoId = eachInsuranceMaster.ContactInfoId; boInsuranceMaster.ZeusID = eachInsuranceMaster.ZeusID; boInsuranceMaster.PriorityBilling = eachInsuranceMaster.PriorityBilling; boInsuranceMaster.Only1500Form = eachInsuranceMaster.Only1500Form; boInsuranceMaster.PaperAuthorization = eachInsuranceMaster.PaperAuthorization; boInsuranceMaster.CreatedByCompanyId = eachInsuranceMaster.CreatedByCompanyId; //if (eachInsuranceMaster.IsDeleted.HasValue) // boInsuranceMaster.IsDeleted = eachInsuranceMaster.IsDeleted.Value; if (eachInsuranceMaster.AddressInfo != null) { BO.AddressInfo boAddress = new BO.AddressInfo(); boAddress.Name = eachInsuranceMaster.AddressInfo.Name; boAddress.Address1 = eachInsuranceMaster.AddressInfo.Address1; boAddress.Address2 = eachInsuranceMaster.AddressInfo.Address2; boAddress.City = eachInsuranceMaster.AddressInfo.City; boAddress.State = eachInsuranceMaster.AddressInfo.State; boAddress.ZipCode = eachInsuranceMaster.AddressInfo.ZipCode; boAddress.Country = eachInsuranceMaster.AddressInfo.Country; //[STATECODE-CHANGE] //boAddress.StateCode = eachInsuranceMaster.AddressInfo.StateCode; //[STATECODE-CHANGE] boAddress.CreateByUserID = eachInsuranceMaster.AddressInfo.CreateByUserID; boAddress.ID = eachInsuranceMaster.AddressInfo.id; boInsuranceMaster.AddressInfo = boAddress; } if (eachInsuranceMaster.ContactInfo != null) { BO.ContactInfo boContactInfo = new BO.ContactInfo(); boContactInfo.Name = eachInsuranceMaster.ContactInfo.Name; boContactInfo.CellPhone = eachInsuranceMaster.ContactInfo.CellPhone; boContactInfo.EmailAddress = eachInsuranceMaster.ContactInfo.EmailAddress; boContactInfo.HomePhone = eachInsuranceMaster.ContactInfo.HomePhone; boContactInfo.WorkPhone = eachInsuranceMaster.ContactInfo.WorkPhone; boContactInfo.FaxNo = eachInsuranceMaster.ContactInfo.FaxNo; boContactInfo.CreateByUserID = eachInsuranceMaster.ContactInfo.CreateByUserID; boContactInfo.ID = eachInsuranceMaster.ContactInfo.id; boContactInfo.OfficeExtension = eachInsuranceMaster.ContactInfo.OfficeExtension; boContactInfo.AlternateEmail = eachInsuranceMaster.ContactInfo.AlternateEmail; boContactInfo.PreferredCommunication = eachInsuranceMaster.ContactInfo.PreferredCommunication; boInsuranceMaster.ContactInfo = boContactInfo; } boInsuranceMaster.IsDeleted = eachInsuranceMaster.IsDeleted; boInsuranceMaster.CreateByUserID = eachInsuranceMaster.CreateByUserID; boInsuranceMaster.UpdateByUserID = eachInsuranceMaster.UpdateByUserID; boInsuranceMasters.Add(boInsuranceMaster); } return((T)(object)boInsuranceMasters); }
public override T ObjectConvert <T, U>(U entity) { InsuranceMaster insuranceMaster = entity as InsuranceMaster; if (insuranceMaster == null) { return(default(T)); } BO.InsuranceMaster boInsuranceMaster = new BO.InsuranceMaster(); boInsuranceMaster.ID = insuranceMaster.Id; boInsuranceMaster.CompanyCode = insuranceMaster.CompanyCode; boInsuranceMaster.CompanyName = insuranceMaster.CompanyName; boInsuranceMaster.AddressInfoId = insuranceMaster.AddressInfoId; boInsuranceMaster.ContactInfoId = insuranceMaster.ContactInfoId; boInsuranceMaster.ZeusID = insuranceMaster.ZeusID; boInsuranceMaster.PriorityBilling = insuranceMaster.PriorityBilling; boInsuranceMaster.Only1500Form = insuranceMaster.Only1500Form; boInsuranceMaster.PaperAuthorization = insuranceMaster.PaperAuthorization; boInsuranceMaster.CreatedByCompanyId = insuranceMaster.CreatedByCompanyId; //if (insuranceMaster.IsDeleted.HasValue) // boInsuranceMaster.IsDeleted = insuranceMaster.IsDeleted.Value; if (insuranceMaster.AddressInfo != null) { BO.AddressInfo boAddress = new BO.AddressInfo(); boAddress.Name = insuranceMaster.AddressInfo.Name; boAddress.Address1 = insuranceMaster.AddressInfo.Address1; boAddress.Address2 = insuranceMaster.AddressInfo.Address2; boAddress.City = insuranceMaster.AddressInfo.City; boAddress.State = insuranceMaster.AddressInfo.State; boAddress.ZipCode = insuranceMaster.AddressInfo.ZipCode; boAddress.Country = insuranceMaster.AddressInfo.Country; boAddress.CreateByUserID = insuranceMaster.AddressInfo.CreateByUserID; boAddress.ID = insuranceMaster.AddressInfo.id; boAddress.IsDeleted = insuranceMaster.AddressInfo.IsDeleted; boInsuranceMaster.AddressInfo = boAddress; } if (insuranceMaster.ContactInfo != null) { BO.ContactInfo boContactInfo = new BO.ContactInfo(); boContactInfo.Name = insuranceMaster.ContactInfo.Name; boContactInfo.CellPhone = insuranceMaster.ContactInfo.CellPhone; boContactInfo.EmailAddress = insuranceMaster.ContactInfo.EmailAddress; boContactInfo.HomePhone = insuranceMaster.ContactInfo.HomePhone; boContactInfo.WorkPhone = insuranceMaster.ContactInfo.WorkPhone; boContactInfo.FaxNo = insuranceMaster.ContactInfo.FaxNo; boContactInfo.OfficeExtension = insuranceMaster.ContactInfo.OfficeExtension; boContactInfo.AlternateEmail = insuranceMaster.ContactInfo.AlternateEmail; boContactInfo.PreferredCommunication = insuranceMaster.ContactInfo.PreferredCommunication; boContactInfo.CreateByUserID = insuranceMaster.ContactInfo.CreateByUserID; boContactInfo.ID = insuranceMaster.ContactInfo.id; boContactInfo.IsDeleted = insuranceMaster.ContactInfo.IsDeleted; boInsuranceMaster.ContactInfo = boContactInfo; } boInsuranceMaster.IsDeleted = insuranceMaster.IsDeleted; boInsuranceMaster.CreateByUserID = insuranceMaster.CreateByUserID; boInsuranceMaster.UpdateByUserID = insuranceMaster.UpdateByUserID; return((T)(object)boInsuranceMaster); }
public override T Convert <T, U>(U entity) { PatientInsuranceInfo InsuranceInfos = entity as PatientInsuranceInfo; if (InsuranceInfos == null) { return(default(T)); } BO.PatientInsuranceInfo insuranceBO = new BO.PatientInsuranceInfo(); insuranceBO.ID = InsuranceInfos.Id; insuranceBO.CaseId = InsuranceInfos.CaseId; insuranceBO.PolicyHoldersName = InsuranceInfos.PolicyHolderName; insuranceBO.PolicyHolderAddressInfoId = InsuranceInfos.PolicyHolderAddressInfoId; insuranceBO.PolicyHolderContactInfoId = InsuranceInfos.PolicyHolderContactInfoId; insuranceBO.PolicyOwnerId = InsuranceInfos.PolicyOwnerId; insuranceBO.InsuranceMasterId = InsuranceInfos.InsuranceMasterId; insuranceBO.InsuranceCompanyCode = InsuranceInfos.InsuranceCompanyCode; insuranceBO.InsuranceCompanyAddressInfoId = InsuranceInfos.InsuranceCompanyAddressInfoId; insuranceBO.InsuranceCompanyContactInfoId = InsuranceInfos.InsuranceCompanyContactInfoId; insuranceBO.PolicyNo = InsuranceInfos.PolicyNo; insuranceBO.ContactPerson = InsuranceInfos.ContactPerson; insuranceBO.InsuranceTypeId = InsuranceInfos.InsuranceTypeId; insuranceBO.IsInActive = InsuranceInfos.IsInActive; if (InsuranceInfos.AddressInfo != null) { if (InsuranceInfos.AddressInfo.IsDeleted.HasValue == false || (InsuranceInfos.AddressInfo.IsDeleted.HasValue == true && InsuranceInfos.AddressInfo.IsDeleted.Value == false)) { BO.AddressInfo boAddress = new BO.AddressInfo(); boAddress.Name = InsuranceInfos.AddressInfo.Name; boAddress.Address1 = InsuranceInfos.AddressInfo.Address1; boAddress.Address2 = InsuranceInfos.AddressInfo.Address2; boAddress.City = InsuranceInfos.AddressInfo.City; boAddress.State = InsuranceInfos.AddressInfo.State; boAddress.ZipCode = InsuranceInfos.AddressInfo.ZipCode; boAddress.Country = InsuranceInfos.AddressInfo.Country; //[STATECODE-CHANGE] //boAddress.StateCode = InsuranceInfos.AddressInfo.StateCode; //[STATECODE-CHANGE] boAddress.CreateByUserID = InsuranceInfos.AddressInfo.CreateByUserID; boAddress.ID = InsuranceInfos.AddressInfo.id; insuranceBO.AddressInfo = boAddress; } } if (InsuranceInfos.ContactInfo != null) { if (InsuranceInfos.ContactInfo.IsDeleted.HasValue == false || (InsuranceInfos.ContactInfo.IsDeleted.HasValue == true && InsuranceInfos.ContactInfo.IsDeleted.Value == false)) { BO.ContactInfo boContactInfo = new BO.ContactInfo(); boContactInfo.Name = InsuranceInfos.ContactInfo.Name; boContactInfo.CellPhone = InsuranceInfos.ContactInfo.CellPhone; boContactInfo.EmailAddress = InsuranceInfos.ContactInfo.EmailAddress; boContactInfo.HomePhone = InsuranceInfos.ContactInfo.HomePhone; boContactInfo.WorkPhone = InsuranceInfos.ContactInfo.WorkPhone; boContactInfo.FaxNo = InsuranceInfos.ContactInfo.FaxNo; boContactInfo.OfficeExtension = InsuranceInfos.ContactInfo.OfficeExtension; boContactInfo.AlternateEmail = InsuranceInfos.ContactInfo.AlternateEmail; boContactInfo.PreferredCommunication = InsuranceInfos.ContactInfo.PreferredCommunication; boContactInfo.CreateByUserID = InsuranceInfos.ContactInfo.CreateByUserID; boContactInfo.ID = InsuranceInfos.ContactInfo.id; insuranceBO.ContactInfo = boContactInfo; } } if (InsuranceInfos.AddressInfo1 != null) { if (InsuranceInfos.AddressInfo1.IsDeleted.HasValue == false || (InsuranceInfos.AddressInfo1.IsDeleted.HasValue == true && InsuranceInfos.AddressInfo1.IsDeleted.Value == false)) { BO.AddressInfo boAddress1 = new BO.AddressInfo(); boAddress1.Name = InsuranceInfos.AddressInfo1.Name; boAddress1.Address1 = InsuranceInfos.AddressInfo1.Address1; boAddress1.Address2 = InsuranceInfos.AddressInfo1.Address2; boAddress1.City = InsuranceInfos.AddressInfo1.City; boAddress1.State = InsuranceInfos.AddressInfo1.State; boAddress1.ZipCode = InsuranceInfos.AddressInfo1.ZipCode; boAddress1.Country = InsuranceInfos.AddressInfo1.Country; //[STATECODE-CHANGE] //boAddress1.StateCode = InsuranceInfos.AddressInfo1.StateCode; //[STATECODE-CHANGE] boAddress1.CreateByUserID = InsuranceInfos.AddressInfo1.CreateByUserID; boAddress1.ID = InsuranceInfos.AddressInfo1.id; insuranceBO.AddressInfo1 = boAddress1; } } if (InsuranceInfos.ContactInfo1 != null) { if (InsuranceInfos.ContactInfo1.IsDeleted.HasValue == false || (InsuranceInfos.ContactInfo1.IsDeleted.HasValue == true && InsuranceInfos.ContactInfo1.IsDeleted.Value == false)) { BO.ContactInfo boContactInfo1 = new BO.ContactInfo(); boContactInfo1.Name = InsuranceInfos.ContactInfo1.Name; boContactInfo1.CellPhone = InsuranceInfos.ContactInfo1.CellPhone; boContactInfo1.EmailAddress = InsuranceInfos.ContactInfo1.EmailAddress; boContactInfo1.HomePhone = InsuranceInfos.ContactInfo1.HomePhone; boContactInfo1.WorkPhone = InsuranceInfos.ContactInfo1.WorkPhone; boContactInfo1.FaxNo = InsuranceInfos.ContactInfo1.FaxNo; boContactInfo1.OfficeExtension = InsuranceInfos.ContactInfo1.OfficeExtension; boContactInfo1.AlternateEmail = InsuranceInfos.ContactInfo1.AlternateEmail; boContactInfo1.PreferredCommunication = InsuranceInfos.ContactInfo1.PreferredCommunication; boContactInfo1.CreateByUserID = InsuranceInfos.ContactInfo1.CreateByUserID; boContactInfo1.ID = InsuranceInfos.ContactInfo1.id; insuranceBO.ContactInfo1 = boContactInfo1; } } if (InsuranceInfos.InsuranceMaster != null) { if (InsuranceInfos.InsuranceMaster.IsDeleted.HasValue == false || (InsuranceInfos.InsuranceMaster.IsDeleted.HasValue == true && InsuranceInfos.InsuranceMaster.IsDeleted.Value == false)) { BO.InsuranceMaster boInsuranceMaster = new BO.InsuranceMaster(); using (InsuranceMasterRepository cmp = new InsuranceMasterRepository(_context)) { boInsuranceMaster = cmp.ObjectConvert <BO.InsuranceMaster, InsuranceMaster>(InsuranceInfos.InsuranceMaster); insuranceBO.InsuranceMaster = boInsuranceMaster; } } } if (InsuranceInfos.InsuranceType != null) { if (InsuranceInfos.InsuranceType.IsDeleted.HasValue == false || (InsuranceInfos.InsuranceType.IsDeleted.HasValue == true && InsuranceInfos.InsuranceType.IsDeleted.Value == false)) { BO.InsuranceType boInsuranceType = new BO.InsuranceType(); boInsuranceType.InsuranceTypeText = InsuranceInfos.InsuranceType.InsuranceTypeText; insuranceBO.InsuranceType = boInsuranceType; } } insuranceBO.IsDeleted = InsuranceInfos.IsDeleted; insuranceBO.CreateByUserID = InsuranceInfos.CreateByUserID; insuranceBO.UpdateByUserID = InsuranceInfos.UpdateByUserID; return((T)(object)insuranceBO); }
public T ConvertEOvisit <T, U>(U entity) { if (entity is EOVisit) { EOVisit EOVisit = entity as EOVisit; if (EOVisit == null) { return(default(T)); } BO.EOVisit EOVisitBO = new BO.EOVisit(); EOVisitBO.ID = EOVisit.ID; EOVisitBO.CalendarEventId = EOVisit.CalendarEventId; EOVisitBO.DoctorId = EOVisit.DoctorId; EOVisitBO.PatientId = EOVisit.PatientId; EOVisitBO.VisitCreatedByCompanyId = EOVisit.PatientId; EOVisitBO.InsuranceProviderId = EOVisit.InsuranceProviderId; EOVisitBO.VisitStatusId = EOVisit.VisitStatusId; EOVisitBO.EventStart = EOVisit.EventStart; EOVisitBO.EventEnd = EOVisit.EventEnd; EOVisitBO.Notes = EOVisit.Notes; EOVisitBO.IsDeleted = EOVisit.IsDeleted; EOVisitBO.CreateByUserID = EOVisit.CreateByUserID; EOVisitBO.UpdateByUserID = EOVisit.UpdateByUserID; if (EOVisit.Doctor != null) { BO.Doctor doctorBO = new BO.Doctor(); using (DoctorRepository patientRepo = new DoctorRepository(_context)) { doctorBO = patientRepo.Convert <BO.Doctor, Doctor>(EOVisit.Doctor); EOVisitBO.Doctor = doctorBO; } } if (EOVisit.Patient != null) { BO.Patient PatientBO = new BO.Patient(); using (PatientRepository patientRepo = new PatientRepository(_context)) { PatientBO = patientRepo.Convert <BO.Patient, Patient>(EOVisit.Patient); EOVisitBO.Patient = PatientBO; } } if (EOVisit.Company != null) { BO.Company CompanyBO = new BO.Company(); using (CompanyRepository companyRepo = new CompanyRepository(_context)) { CompanyBO = companyRepo.Convert <BO.Company, Company>(EOVisit.Company); EOVisitBO.Company = CompanyBO; } } if (EOVisit.InsuranceMaster != null) { BO.InsuranceMaster InsuranceMasterBO = new BO.InsuranceMaster(); using (InsuranceMasterRepository InsuranceMasterRepo = new InsuranceMasterRepository(_context)) { InsuranceMasterBO = InsuranceMasterRepo.ObjectConvert <BO.InsuranceMaster, InsuranceMaster>(EOVisit.InsuranceMaster); EOVisitBO.InsuranceMaster = InsuranceMasterBO; } } if (EOVisit.CalendarEvent != null) { EOVisitBO.CalendarEvent = new BO.CalendarEvent(); using (CalendarEventRepository calEventRep = new CalendarEventRepository(_context)) { EOVisitBO.CalendarEvent = calEventRep.Convert <BO.CalendarEvent, CalendarEvent>(EOVisit.CalendarEvent); } } return((T)(object)EOVisitBO); } return(default(T)); }