public ACM.Model.Campaign CampaignAdd(ACM.Model.Campaign request) { ACM.Model.Campaign response = new ACM.Model.Campaign(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { request.CreatedDate = DateTime.Now; ctx.Campaigns.Add(request); ctx.SaveChanges(); ctx.Configuration.ProxyCreationEnabled = false; response = (from campaign in ctx.Campaigns where campaign.CampaignGuid == request.CampaignGuid orderby campaign.CampaignId descending select campaign).First(); ctx.Configuration.ProxyCreationEnabled = true; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignAdd"); throw; } return response; }
public JsonResult ReinstateCancelCampaign(int?CampaignId = 0) { try { if (CampaignId == 0) { CampaignId = (Int32)Session["CampaignId"]; } ACM.Model.Campaign campaign = new ACM.Model.Campaign(); campaign.CampaignId = Convert.ToInt32(CampaignId); var campaignInq = campaignServiceClient.CampaignInq(campaign); if (campaignInq != null) { if (campaignInq.CampaignStatus == "Cancelled") { campaignInq.CampaignStatus = "Active"; } else if (campaignInq.CampaignStatus != "Cancelled") { campaignInq.CampaignStatus = "Cancelled"; } var Campaignval = campaignServiceClient.CampaignMod(campaignInq); var campaignInq1 = campaignServiceClient.CampaignInq(campaign); return(Json(campaignInq1.CampaignStatus, JsonRequestBehavior.AllowGet)); } else { return(Json(null, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json("Error")); } }
public List <ACM.Model.Campaign> CampaignInfo(ACM.Model.Campaign request) { List <ACM.Model.Campaign> response = new List <ACM.Model.Campaign>(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Configuration.ProxyCreationEnabled = false; if (request != null && request.RequestorId != null && request.RequestorId != 0) { response = (from campaign in ctx.Campaigns where campaign.RequestorId == request.RequestorId select campaign).ToList(); } else { response = (from campaign in ctx.Campaigns select campaign).ToList(); } ctx.Configuration.ProxyCreationEnabled = true; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignInfo"); throw; } return(response); }
public ACM.Model.Campaign CampaignAdd(ACM.Model.Campaign request) { ACM.Model.Campaign response = new ACM.Model.Campaign(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { request.CreatedDate = DateTime.Now; ctx.Campaigns.Add(request); ctx.SaveChanges(); ctx.Configuration.ProxyCreationEnabled = false; response = (from campaign in ctx.Campaigns where campaign.CampaignGuid == request.CampaignGuid orderby campaign.CampaignId descending select campaign).First(); ctx.Configuration.ProxyCreationEnabled = true; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignAdd"); throw; } return(response); }
public JsonResult SaveCampaign(ACM.Model.Campaign NewCampaign, ACM.Model.CampaignTargetFileProvider[] NewCampaignTFPList, ACM.Model.CampaignLocation[] NewCampaignLocationList) { //list local variables CampaignRequestBO CampRequestBO = new CampaignRequestBO(); CampRequestBO.SaveCampaign(NewCampaign, NewCampaignTFPList, NewCampaignLocationList); var SaveResult = new { result = "Changes Saved!" }; return(Json(SaveResult, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveCampaignNotes(int CampaignId, string Notes) { ACM.Model.Campaign campaign = new ACM.Model.Campaign(); campaign.CampaignId = Convert.ToInt32(CampaignId); var campaignInq = campaignServiceClient.CampaignInq(campaign); campaignInq.Notes = Notes; var Campaignval = campaignServiceClient.CampaignMod(campaignInq); return(Json(Campaignval, JsonRequestBehavior.AllowGet)); }
public void SaveCampaign(ACM.Model.Campaign campaign, ACM.Model.CampaignTargetFileProvider[] campaignTFPL, ACM.Model.CampaignLocation[] campaignLocList) { try { CampaignRequestBO campaignRequestBO = new CampaignRequestBO(); campaignRequestBO.SaveCampaign(campaign, campaignTFPL, campaignLocList); } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "SaveCampaign"); throw; } }
public string CampaignDel(Campaign request) { try { return campaignProxy.CampaignDel(request); } catch (Exception exp) { WCFFaultException.GetClientException(exp, "CampaignDel"); throw new Exception(exp.ToString()); } }
public ACM.Model.Campaign CampaignAdd(Campaign request) { try { return campaignProxy.CampaignAdd(request); } catch (Exception exp) { WCFFaultException.GetClientException(exp, "CampaignAdd"); throw new Exception(exp.ToString()); } }
public ACM.Model.Campaign GetCampaignInfoById(int campaignId) { try { ACMContex.Configuration.LazyLoadingEnabled = true; ACM.Model.Campaign campaign = ACMContex.Campaigns.Find(campaignId); return(campaign); } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "GetCampaignInfoById"); throw; } }
public string CampaignMod(ACM.Model.Campaign request) { try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { request.ModifiedDate = DateTime.Now; ctx.Entry(request).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignMod"); throw; } return("Successfully updated"); }
public string CampaignDel(ACM.Model.Campaign request) { try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ACM.Model.Campaign campaign = ctx.Campaigns.Find(request.CampaignId); ctx.Campaigns.Remove(request); ctx.SaveChanges(); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignDel"); throw; } return("Successfully deleted"); }
public void SaveCampaign(ACM.Model.Campaign campaign, ACM.Model.CampaignTargetFileProvider[] campaignTFPL, ACM.Model.CampaignLocation[] campaignLocList) { CampaignRequestDAO campaignRequestDAO = new CampaignRequestDAO(); List <CampaignTargetFileProvider> lstcampaignTFPL = new List <CampaignTargetFileProvider>(); List <CampaignLocation> lstcampaignLocList = new List <CampaignLocation>(); if (campaignTFPL != null) { lstcampaignTFPL = campaignTFPL.ToList(); } if (campaignLocList != null) { lstcampaignLocList = campaignLocList.ToList(); } campaignRequestDAO.SaveCampaign(campaign, lstcampaignTFPL, lstcampaignLocList); return; }
public void CancelCampaign(int CampaignId) { try { ACM.Model.Campaign campaign = ACMContex.Campaigns.First(i => i.CampaignId == CampaignId); campaign.CampaignStatus = "Cancelled"; List <CampaignTargetFileProvider> campaignTargetFileProviderList = ACMContex.CampaignTargetFileProviders.ToList(); List <CampaignTargetFileProvider> campaignTargetFileProviderListByCampaignId = campaignTargetFileProviderList.Where(x => x.CampaignId.Equals(CampaignId)).ToList(); //shravan changes for sprint 2 //if (campaignTargetFileProviderListByCampaignId != null) //{ // foreach (CampaignTargetFileProvider campaignTargetFileProvider in campaignTargetFileProviderListByCampaignId) // { // campaignTargetFileProvider.Status = "Cancelled"; // } //} //List<CampaignLocation> campaignLocationList = ACMContex.CampaignLocations.ToList(); //List<CampaignLocation> campaignLocationListByCampaignId = campaignLocationList.Where(x => x.CampaignId.Equals(CampaignId)).ToList(); //if (campaignLocationListByCampaignId != null) //{ // foreach (CampaignLocation campaignTargetFileProvider in campaignLocationListByCampaignId) // { // campaignTargetFileProvider.Status = "Cancelled"; // } //} ACMContex.SaveChanges(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); throw; } }
/// <summary> /// CampaignView Section is the Integration part of the CampaignInfo, Targetfile Provider, Followup /// Mainframe and Left Navigaton section /// </summary> /// <returns></returns> public ActionResult CampaignView(int?CampaignId) { if (CampaignId == null) { CampaignId = 0; } Session["CampaignId"] = CampaignId; ACM.Model.Campaign campaign = new ACM.Model.Campaign(); campaign.CampaignId = Convert.ToInt32(CampaignId); var campaignInq = campaignServiceClient.CampaignInq(campaign); if (campaignInq == null) { campaignInq = new Model.Campaign(); } if (CampaignId == 0) { ViewBag.ViewMode = "Add"; } Session["Note"] = campaignInq.Notes; return(View(campaignInq)); }
public ACM.Model.Campaign CampaignInq(ACM.Model.Campaign request) { ACM.Model.Campaign response = new ACM.Model.Campaign(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Configuration.LazyLoadingEnabled = true; ctx.Configuration.ProxyCreationEnabled = false; if (request != null) { response = ctx.Campaigns.Find(request.CampaignId); ctx.Campaigns.Include("CampaignTableStatu").ToList(); } } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignInq"); throw; } return(response); }
public PartialViewInfo CampaignLeftNavigationDetails(int campaignId) { ACM.Model.Campaign response = new ACM.Model.Campaign(); PartialViewInfo partialInfo = new PartialViewInfo(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { var listItems = (ctx.Database.SqlQuery <GetLeftNavDetails_Result>("GetLeftNavDetails @CampaignId", new SqlParameter("CampaignId", campaignId) )).ToList(); foreach (var item in listItems) { partialInfo.CampaignId = item.campaignId; partialInfo.CampaignType = item.CampaignTypeName; partialInfo.CampaignName = item.campaignname; partialInfo.ATMPM = item.primaryPMName; partialInfo.SecondaryPM = item.secondaryPMName; partialInfo.PromoButton = item.PromoButtonName; partialInfo.Note = item.Notes; partialInfo.Status = item.campaignstatus; } return(partialInfo); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignLeftNavigationDetails"); throw; } }
public List<Campaign> CampaignInfo(Campaign request) { try { return campaignProxy.CampaignInfo(request); } catch (Exception exp) { WCFFaultException.GetClientException(exp, "CampaignInfo"); throw new Exception(exp.ToString()); } }
public void SaveCampaign(Campaign campaign, List<CampaignTargetFileProvider> campaignTFPL, List<CampaignLocation> campaignLocList) { try { campaignProxy.SaveCampaign(campaign, campaignTFPL, campaignLocList); } catch (Exception exp) { WCFFaultException.GetClientException(exp, "SaveCampaign"); throw new Exception(exp.ToString()); } }
public JsonResult SaveCampaignInfo(ACM.Model.Campaign campaign) { try { DateTime minDate = DateTime.Parse("01/01/2000"); if (campaign.CampaignStartDate < minDate || campaign.CampaingEndDate < minDate) { if (campaign.CampaignStartDate < minDate && !campaign.CampaignStartDate.Equals(DateTime.MinValue)) { ModelState.AddModelError("Camapaign StartDate", "Invalid date entered in Start Date. Please enter the date over 01/01/2000 "); } if (campaign.CampaingEndDate < minDate && !campaign.CampaingEndDate.Equals(DateTime.MinValue)) { ModelState.AddModelError("Camapaign EndtDate", "Invalid date entered in End Date. Please enter the date over 01/01/2000 "); } } if (!campaign.CampaingEndDate.Equals(DateTime.MinValue)) { if (campaign.CampaingEndDate <= campaign.CampaignStartDate) { ModelState.AddModelError("Camapaign EndDate", "End Date cannot be prior than Start Date"); } } if (campaign.CampaignTypeId == null) { ModelState.AddModelError("CamapaignType", "The CamapaignType field is required."); } string loginId = Utility.LoginId(User.Identity.Name); ACM.BO.Admin.UsersBO usersBO = new ACM.BO.Admin.UsersBO(); // ACM.BO.Campaign.CampaignRequestBO campaignRequestBO = new ACM.BO.Campaign.CampaignRequestBO(); ViewBag.test = loginId; var userDetail = usersBO.GetUserDetail(loginId); if (ModelState.IsValid) { DateTime dt; string[] splitDates = campaign.Notes.Split('|'); if (DateTime.TryParse(splitDates[0], out dt) && DateTime.TryParse(splitDates[0], out dt)) { campaign.Notes = string.Empty; if (campaign.CampaignId == 0) { campaign.CreatedBy = userDetail.UserId; Guid gid = Guid.NewGuid(); campaign.CampaignGuid = gid.ToString(); var campaignInq = campaignServiceClient.CampaignAdd(campaign); Session["CampaignId"] = campaignInq.CampaignId; return(Json(campaignInq)); } else { campaign.ModifiedBy = userDetail.UserId; campaignServiceClient.CampaignMod(campaign); return(Json(campaign)); } } else { return(Json("DateError")); } } else { IEnumerable <ModelError> errors = ModelState.Values.SelectMany(v => v.Errors); return(Json(errors)); } } catch { return(Json("Error")); } }
public ActionResult CampaignInfoSection(ACM.Model.Campaign cmp) { ViewBag.disablecontrols = false; ACM.Model.Campaign campaign = new ACM.Model.Campaign(); campaign.CampaignId = Convert.ToInt32(cmp.CampaignId); var campaignInq = campaignServiceClient.CampaignInq(campaign); var campaigntypelist = campaignServiceClient.GetMasterDropDownDataforMasterTables("CampaignTypeId", "CampaignTypeName", "CampaignType"); ViewBag.campaigntypelist = new SelectList(campaigntypelist, "ID", "Name"); var loblist = campaignServiceClient.GetMasterDropDownDataforMasterTables("LOBId", "LOBName", "LOB"); ViewBag.loblist = new SelectList(loblist, "ID", "Name"); var primarypmlist = campaignServiceClient.GetMasterDropDownDataforMasterTables("UserID", "FirstName+ ' ' +LastName", "Users"); ViewBag.primarypmlist = new SelectList(primarypmlist, "ID", "Name"); var secondarypmlist = campaignServiceClient.GetMasterDropDownDataforMasterTables("UserID", "FirstName+ ' ' +LastName", "Users"); ViewBag.secondarypmlist = new SelectList(secondarypmlist, "ID", "Name"); var promobuttontypelist = campaignServiceClient.GetMasterDropDownDataforMasterTables("PromoButtonTypeId", "PromoButtonName", "PromoButton"); ViewBag.promobuttontypelist = new SelectList(promobuttontypelist, "ID", "Name"); var productplacementlist = campaignServiceClient.GetMasterDropDownDataforMasterTables("ProductPlacementId", "Description", "ProductPlacement"); ViewBag.productplacementlist = new SelectList(productplacementlist, "ID", "Name"); var supercategory = campaignServiceClient.GetMasterDropDownDataforMasterTables("SuperCategoryID", "SuperCategoryName", "SuperCategory"); ViewBag.supercategory = new SelectList(supercategory, "ID", "Name"); var campaignType = campaignServiceClient.GetMasterDropDownDataforMasterTables("SuperCategoryID", "SuperCategoryName", "SuperCategory"); ViewBag.supercategory = new SelectList(campaignType, "ID", "Name"); var campaignTableStatuslist = campaignServiceClient.GetMasterDropDownDataforMasterTables("CampaignTableStatusId", "CampaignTableStatusDescription", "CampaignTableStatus"); ViewBag.campaignTableStatuslist = new SelectList(campaignTableStatuslist, "ID", "Name"); var category = campaignServiceClient.GetMasterDropDownDataforMasterTables("CategoryID", "CategoryName", "Category"); ViewBag.category = new SelectList(category, "ID", "Name"); if (campaignInq != null) { if (campaignInq.CategoryId != null) { ViewBag.categoryName = category.Find(x => x.ID == campaignInq.CategoryId).Name; } } var subcategory = campaignServiceClient.GetMasterDropDownDataforMasterTables("SubCategoryID", "SubCategoryName", "SubCategory"); ViewBag.subcategory = new SelectList(subcategory, "ID", "Name"); if (campaignInq != null) { if (campaignInq.SubCategoryId != null) { ViewBag.subCategoryName = subcategory.Find(x => x.ID == campaignInq.SubCategoryId).Name; } } var campaignTableStatusList = campaignServiceClient.GetMasterDropDownDataforMasterTables("CampaignTableStatusId", "CampaignTableStatusDescription", "CampaignTableStatus"); ViewBag.campaignTableStatusList = new SelectList(campaignTableStatusList, "ID", "Name"); var requestorlist = campaignServiceClient.GetMasterDropDownDataforMasterTables("UserID", "FirstName+ ' ' +LastName", "Users"); ViewBag.requestorlist = new SelectList(requestorlist, "ID", "Name"); var eventTrigger = campaignServiceClient.GetMasterDropDownDataforMasterTables("EventTriggerId", "EventTriggerName", "EventTrigger"); ViewBag.eventTrigger = new SelectList(eventTrigger, "ID", "Name"); // var campaign = cmpbo.GetCampaign(100); if (campaignInq == null) { campaignInq = new Model.Campaign(); CampaignTableStatu campaignTableStatu = new CampaignTableStatu(); campaignInq.CampaignTableStatu = campaignTableStatu; } if (campaignInq.CampaignTypeId != null) { var campaignTypeValue = campaigntypelist.Find(x => x.ID == campaignInq.CampaignTypeId); ViewBag.campaignTypeName = campaignTypeValue.Name; ViewBag.campaignTypeId = campaignInq.CampaignTypeId; } return(PartialView(campaignInq)); }
/// <summary> /// CampaignView Section is the Integration part of the CampaignInfo, Targetfile Provider, Followup /// Mainframe and Left Navigaton section /// </summary> /// <returns></returns> public ActionResult CampaignView(int? CampaignId) { if (CampaignId == null) CampaignId = 0; Session["CampaignId"] = CampaignId; ACM.Model.Campaign campaign = new ACM.Model.Campaign(); campaign.CampaignId = Convert.ToInt32(CampaignId); var campaignInq = campaignServiceClient.CampaignInq(campaign); if (campaignInq == null) campaignInq = new Model.Campaign(); if (CampaignId == 0) ViewBag.ViewMode = "Add"; Session["Note"] = campaignInq.Notes; return View(campaignInq); }
public JsonResult ReinstateCancelCampaign(int? CampaignId = 0) { try { if (CampaignId == 0) CampaignId = (Int32)Session["CampaignId"]; ACM.Model.Campaign campaign = new ACM.Model.Campaign(); campaign.CampaignId = Convert.ToInt32(CampaignId); var campaignInq = campaignServiceClient.CampaignInq(campaign); if (campaignInq != null) { if (campaignInq.CampaignStatus == "Cancelled") { campaignInq.CampaignStatus = "Active"; } else if (campaignInq.CampaignStatus != "Cancelled") { campaignInq.CampaignStatus = "Cancelled"; } var Campaignval = campaignServiceClient.CampaignMod(campaignInq); var campaignInq1 = campaignServiceClient.CampaignInq(campaign); return Json(campaignInq1.CampaignStatus, JsonRequestBehavior.AllowGet); } else { return Json(null, JsonRequestBehavior.AllowGet); } } catch (Exception ex) { return Json("Error"); } }
public JsonResult SaveCampaignNotes(int CampaignId, string Notes) { ACM.Model.Campaign campaign = new ACM.Model.Campaign(); campaign.CampaignId = Convert.ToInt32(CampaignId); var campaignInq = campaignServiceClient.CampaignInq(campaign); campaignInq.Notes = Notes; var Campaignval = campaignServiceClient.CampaignMod(campaignInq); return Json(Campaignval, JsonRequestBehavior.AllowGet); }
public ActionResult CampaignInfoSection(ACM.Model.Campaign cmp) { ViewBag.disablecontrols = false; ACM.Model.Campaign campaign = new ACM.Model.Campaign(); campaign.CampaignId = Convert.ToInt32(cmp.CampaignId); var campaignInq = campaignServiceClient.CampaignInq(campaign); var campaigntypelist = campaignServiceClient.GetMasterDropDownDataforMasterTables("CampaignTypeId", "CampaignTypeName", "CampaignType"); ViewBag.campaigntypelist = new SelectList(campaigntypelist, "ID", "Name"); var loblist = campaignServiceClient.GetMasterDropDownDataforMasterTables("LOBId", "LOBName", "LOB"); ViewBag.loblist = new SelectList(loblist, "ID", "Name"); var primarypmlist = campaignServiceClient.GetMasterDropDownDataforMasterTables("UserID", "FirstName+ ' ' +LastName", "Users"); ViewBag.primarypmlist = new SelectList(primarypmlist, "ID", "Name"); var secondarypmlist = campaignServiceClient.GetMasterDropDownDataforMasterTables("UserID", "FirstName+ ' ' +LastName", "Users"); ViewBag.secondarypmlist = new SelectList(secondarypmlist, "ID", "Name"); var promobuttontypelist = campaignServiceClient.GetMasterDropDownDataforMasterTables("PromoButtonTypeId", "PromoButtonName", "PromoButton"); ViewBag.promobuttontypelist = new SelectList(promobuttontypelist, "ID", "Name"); var productplacementlist = campaignServiceClient.GetMasterDropDownDataforMasterTables("ProductPlacementId", "Description", "ProductPlacement"); ViewBag.productplacementlist = new SelectList(productplacementlist, "ID", "Name"); var supercategory = campaignServiceClient.GetMasterDropDownDataforMasterTables("SuperCategoryID", "SuperCategoryName", "SuperCategory"); ViewBag.supercategory = new SelectList(supercategory, "ID", "Name"); var campaignType = campaignServiceClient.GetMasterDropDownDataforMasterTables("SuperCategoryID", "SuperCategoryName", "SuperCategory"); ViewBag.supercategory = new SelectList(campaignType, "ID", "Name"); var campaignTableStatuslist = campaignServiceClient.GetMasterDropDownDataforMasterTables("CampaignTableStatusId", "CampaignTableStatusDescription", "CampaignTableStatus"); ViewBag.campaignTableStatuslist = new SelectList(campaignTableStatuslist, "ID", "Name"); var category = campaignServiceClient.GetMasterDropDownDataforMasterTables("CategoryID", "CategoryName", "Category"); ViewBag.category = new SelectList(category, "ID", "Name"); if (campaignInq != null) { if (campaignInq.CategoryId != null) { ViewBag.categoryName = category.Find(x => x.ID == campaignInq.CategoryId).Name; } } var subcategory = campaignServiceClient.GetMasterDropDownDataforMasterTables("SubCategoryID", "SubCategoryName", "SubCategory"); ViewBag.subcategory = new SelectList(subcategory, "ID", "Name"); if (campaignInq != null) { if (campaignInq.SubCategoryId != null) { ViewBag.subCategoryName = subcategory.Find(x => x.ID == campaignInq.SubCategoryId).Name; } } var campaignTableStatusList = campaignServiceClient.GetMasterDropDownDataforMasterTables("CampaignTableStatusId", "CampaignTableStatusDescription", "CampaignTableStatus"); ViewBag.campaignTableStatusList = new SelectList(campaignTableStatusList, "ID", "Name"); var requestorlist = campaignServiceClient.GetMasterDropDownDataforMasterTables("UserID", "FirstName+ ' ' +LastName", "Users"); ViewBag.requestorlist = new SelectList(requestorlist, "ID", "Name"); var eventTrigger = campaignServiceClient.GetMasterDropDownDataforMasterTables("EventTriggerId", "EventTriggerName", "EventTrigger"); ViewBag.eventTrigger = new SelectList(eventTrigger, "ID", "Name"); // var campaign = cmpbo.GetCampaign(100); if (campaignInq == null) { campaignInq = new Model.Campaign(); CampaignTableStatu campaignTableStatu = new CampaignTableStatu(); campaignInq.CampaignTableStatu = campaignTableStatu; } if (campaignInq.CampaignTypeId != null) { var campaignTypeValue = campaigntypelist.Find(x => x.ID == campaignInq.CampaignTypeId); ViewBag.campaignTypeName = campaignTypeValue.Name; ViewBag.campaignTypeId = campaignInq.CampaignTypeId; } return PartialView(campaignInq); }
public ACM.Model.Campaign CampaignInq(ACM.Model.Campaign request) { ACM.Model.Campaign response = new ACM.Model.Campaign(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Configuration.LazyLoadingEnabled = true; ctx.Configuration.ProxyCreationEnabled = false; if (request != null) { response = ctx.Campaigns.Find(request.CampaignId); ctx.Campaigns.Include("CampaignTableStatu").ToList(); } } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignInq"); throw; } return response; }
public PartialViewInfo CampaignLeftNavigationDetails(int campaignId) { ACM.Model.Campaign response = new ACM.Model.Campaign(); PartialViewInfo partialInfo = new PartialViewInfo(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { var listItems = (ctx.Database.SqlQuery<GetLeftNavDetails_Result>("GetLeftNavDetails @CampaignId", new SqlParameter("CampaignId", campaignId) )).ToList(); foreach (var item in listItems) { partialInfo.CampaignId = item.campaignId; partialInfo.CampaignType = item.CampaignTypeName; partialInfo.CampaignName = item.campaignname; partialInfo.ATMPM = item.primaryPMName; partialInfo.SecondaryPM = item.secondaryPMName; partialInfo.PromoButton = item.PromoButtonName; partialInfo.Note = item.Notes; partialInfo.Status = item.campaignstatus; } return partialInfo; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignLeftNavigationDetails"); throw; } }
public void SaveCampaign(ACM.Model.Campaign campaign, List <CampaignTargetFileProvider> campaignTargetFileProviderList, List <CampaignLocation> campaignLocationList) { try { /* * ACM.Model.Campaign campaignObj = new ACM.Model.Campaign(); * { * campaignObj.CampaignId = campaign.CampaignId; * campaignObj.RequestorId = campaign.RequestorId; * campaignObj.LOBId = campaign.LOBId; * campaignObj.CampaignName = campaign.CampaignName; * } * * ACMContex.Campaigns.Add(campaignObj); */ // ACMContex.Entry(campaign).State = EntityState.Modified; int maxid = ACMContex.Campaigns.Select(r => r.CampaignId).Max(); campaign.CampaignId = maxid + 1; ACMContex.Campaigns.Add(campaign); if (campaignTargetFileProviderList != null) { foreach (CampaignTargetFileProvider campaignTargetFileProvider in campaignTargetFileProviderList) { CampaignTargetFileProvider campaignTargetFileProviderObj = new CampaignTargetFileProvider(); campaignTargetFileProvider.CampaignId = maxid + 1; //int CampaignLocationId = ACMContex.CampaignTargetFileProviders .Select(r => r.Id).Max(); //campaignTargetFileProvider.Id = CampaignLocationId + 1; /* * campaignTargetFileProviderObj.CampaignId = campaignTargetFileProvider.CampaignId; * campaignTargetFileProviderObj.TargetFileProviderDesc = campaignTargetFileProvider.TargetFileProviderDesc; * campaignTargetFileProviderObj.Frequency = campaignTargetFileProvider.Frequency; * campaignTargetFileProviderObj.CreatedBy = campaignTargetFileProvider.CreatedBy; * campaignTargetFileProviderObj.CreatedDate = campaignTargetFileProvider.CreatedDate; * campaignTargetFileProviderObj.ModifiedBy = campaignTargetFileProvider.ModifiedBy; * campaignTargetFileProviderObj.ModifiedDate = campaignTargetFileProvider.ModifiedDate; * campaignTargetFileProviderObj.Status = campaignTargetFileProvider.Status; */ campaignTargetFileProvider.Status = "Active"; ACMContex.CampaignTargetFileProviders.Add(campaignTargetFileProvider); } } if (campaignLocationList != null) { foreach (CampaignLocation campaignLocation in campaignLocationList) { CampaignLocation campaignLocationObj = new CampaignLocation(); campaignLocationObj.CampaignId = maxid + 1; // campaignLocationObj.CampaignId = campaignLocation.CampaignId; campaignLocationObj.RegionId = campaignLocation.RegionId; campaignLocationObj.SuperRegionId = campaignLocation.SuperRegionId; //campaignLocationObj.SpecifyRegionName = campaignLocation.SpecifyRegionName; campaignLocationObj.CreatedBy = campaignLocation.CreatedBy; campaignLocationObj.CreatedDate = campaignLocation.CreatedDate; campaignLocationObj.ModifiedBy = campaignLocation.ModifiedBy; campaignLocationObj.ModifiedDate = campaignLocation.ModifiedDate; // campaignLocationObj.Status = campaignLocation.Status; ACMContex.CampaignLocations.Add(campaignLocationObj); } } //ACMContex.Campaigns.Add ACMContex.SaveChanges(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); throw; } }