public CampaignDetail CampaignDetials(int CampaignId) { ACMContex.Configuration.LazyLoadingEnabled = true; ACM.Model.User user = new ACM.Model.User(); LOB lob = new LOB(); CampaignDetail campaignObj = new CampaignDetail(); var campaign = ACMContex.Campaigns.Where(x => x.CampaignId.Equals(CampaignId)); foreach (var item in campaign) { campaignObj.CampaignId = item.CampaignId; campaignObj.RequestorId = item.RequestorId; int requestorId = (Int32)item.RequestorId; if (requestorId != 0) { user = GetUserDetail(requestorId); campaignObj.RequestorFirstName = user.FirstName; campaignObj.RequestorLastName = user.LastName; campaignObj.RequestorName = campaignObj.RequestorFirstName +" "+ campaignObj.RequestorLastName; } campaignObj.LOBId = item.User.LOBId; int lobId = (Int32)item.User.LOBId; if (lobId != 0) { lob = GetLobDetail(lobId); campaignObj.LOBName = lob.LOBName; } campaignObj.AssignedPMId = item.AssignedPMId; int assignedPMId =(Int32) item.AssignedPMId; if (assignedPMId != 0) { user = GetUserDetail(assignedPMId); campaignObj.AssignedPMFirstName = user.FirstName; campaignObj.AssignedPMLastName = user.LastName; campaignObj.AssignedPMName = campaignObj.AssignedPMFirstName +" "+ campaignObj.AssignedPMLastName; } campaignObj.CampaignName = item.CampaignName; if (item.ModifiedBy != 0 && item.ModifiedDate != null) { int modifyBy = item.ModifiedBy; user = GetUserDetail(modifyBy); campaignObj.ModifiedBy = item.ModifiedBy; campaignObj.ModifiedByFirstName = user.FirstName; campaignObj.ModifiedByLastName = user.LastName; campaignObj.ModifiedByName = campaignObj.ModifiedByFirstName +" "+ campaignObj.ModifiedByLastName; campaignObj.ModifiedDate = Convert.ToDateTime(item.ModifiedDate); } campaignObj.CampaignDetails = item.CampaignDetails; campaignObj.CampaignTypeId = Convert.ToInt32(item.CampaignTypeId); if (item.CampaignTypeId.Equals(1)) campaignObj.CampaignTypeName = "Yes"; if (item.CampaignTypeId.Equals(2)) campaignObj.CampaignTypeName = "No"; campaignObj.TargetAudience = item.TargetAudience; campaignObj.FollowUpRequriements = item.FollowUpRequriements; campaignObj.CampaignStartDate =Convert.ToDateTime( item.CampaignStartDate); campaignObj.CampaingEndDate = Convert.ToDateTime(item.CampaingEndDate); } var campaignTargetFileProviderList = ACMContex.CampaignTargetFileProviders.Where(x => x.CampaignId.Equals(CampaignId)); if (campaignTargetFileProviderList != null) { campaignObj.CampaignTargetFileProvider = new List<CampaignTargetFileProvider>(campaignTargetFileProviderList); /* CampaignTargetFileProvider campaignTargetFileProvider = new CampaignTargetFileProvider(); foreach (var item in campaignTargetFileProviderList) { campaignTargetFileProvider = new CampaignTargetFileProvider(); campaignTargetFileProvider.CampaignId = item.CampaignId; campaignTargetFileProvider.Frequency = item.Frequency; campaignTargetFileProvider.TargetFileProviderDesc = item.TargetFileProviderDesc; campaignObj.CampaignTargetFileProvider.Add(campaignTargetFileProvider); } */ } var campaignLocationList = ACMContex.CampaignLocations.Where(x => x.CampaignId.Equals(CampaignId)); if (campaignLocationList != null) { campaignObj.CampaignLocation = new List<CampaignLocation>(campaignLocationList); /* CampaignLocation campaignLocation = new CampaignLocation(); foreach (var item in campaignLocationList) { campaignLocation = new CampaignLocation(); campaignLocation.CampaignId = item.CampaignId; campaignObj.CampaignLocation.Add(campaignLocation); } */ } return campaignObj; }
public LOB GetLobDetail(int id) { ACMContex.Configuration.LazyLoadingEnabled = true; var Lobs = ACMContex.LOBs.Where(x => x.LOBId.Equals(id)); LOB lob = new LOB(); foreach (var item in Lobs) { lob.LOBId = item.LOBId; lob.LOBName = item.LOBName; lob.Status = item.Status; lob.CreatedBy = item.CreatedBy; lob.CreatedDate = item.CreatedDate; } return lob; }