public JsonResult SaveCampaignTargetFileProvider(ACM.Model.CampaignTargetFileProvider CmpTargetFileProvider)
        {
            CampaignTargetFileProvider campaignTargetFileProvider = new CampaignTargetFileProvider();

            CmpTargetFileProvider.CampaignId = Convert.ToInt32(Session["CampaignId"]);
            campaignTargetFileProvider       = campaignServiceClient.CampaigTargetFileInq(CmpTargetFileProvider);

            string loginId = Utility.LoginId(User.Identity.Name);

            ACM.BO.Admin.UsersBO usersBO = new ACM.BO.Admin.UsersBO();
            var userDetail = usersBO.GetUserDetail(loginId);

            CmpTargetFileProvider.ModifiedBy   = userDetail.UserId;
            CmpTargetFileProvider.ModifiedDate = DateTime.Now;
            CmpTargetFileProvider.CreatedDate  = DateTime.Now;

            if (campaignTargetFileProvider == null)
            {
                // CmpTargetFileProvider.CampaignId = Convert.ToInt32(Session["CampaignId"]);
                CmpTargetFileProvider.CreatedBy   = userDetail.UserId;
                CmpTargetFileProvider.CreatedDate = DateTime.Now;
                campaignServiceClient.CampaigTargetFileAdd(CmpTargetFileProvider);
                return(Json(CmpTargetFileProvider));
            }
            else
            {
                campaignServiceClient.CampaigTargetFileMod(CmpTargetFileProvider);
                return(Json(CmpTargetFileProvider));
            }
        }
        public ActionResult CampaignTargetFileProvider(ACM.Model.CampaignTargetFileProvider cmpTargetFileProvider)
        {
            ACM.Model.CampaignTargetFileProvider CampTargetFileProvider = new ACM.Model.CampaignTargetFileProvider();
            CampTargetFileProvider.CampaignId = Convert.ToInt32(cmpTargetFileProvider.CampaignId);

            var campaignTargetFileProvider = campaignServiceClient.CampaigTargetFileInq(CampTargetFileProvider);

            if (campaignTargetFileProvider == null)
            {
                campaignTargetFileProvider            = new Model.CampaignTargetFileProvider();
                campaignTargetFileProvider.CampaignId = CampTargetFileProvider.CampaignId;
            }

            return(PartialView(campaignTargetFileProvider));
        }
 public string CampaigTargetFileAdd(CampaignTargetFileProvider request)
 {
     try
     {
         using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context())
         {
             ctx.CampaignTargetFileProviders.Add(request);
             ctx.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaigTargetFileAdd");
         throw;
     }
     return "Successfully added";
 }
        public string CampaigTargetFileDel(CampaignTargetFileProvider request)
        {
            try
            {
                using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context())
                {
                    CampaignTargetFileProvider campaign = ctx.CampaignTargetFileProviders.Find(request.CampaignId);
                    ctx.CampaignTargetFileProviders.Remove(campaign);
                    ctx.SaveChanges();

                }
            }
            catch (Exception ex)
            {
                Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaigTargetFileDel");
                throw;
            }
            return "Successfully deleted";
        }
        public string CampaigTargetFileMod(CampaignTargetFileProvider request)
        {
            string campaignTarget;
            using (TransactionScope tran = new TransactionScope())
            {
                try
                {
                    if (request.FollowUPNeeded == "No")
                        DeleteFollowUp(request);
                    campaignTarget = campaignTargetFileProviderDAO.CampaigTargetFileMod(request);
                    tran.Complete();

                }
                catch (Exception ex)
                {
                    Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaigTargetFileMod-BO");
                    throw;
                }
            }
            return campaignTarget;
        }
 public CampaignTargetFileProvider CampaigTargetFileInq(CampaignTargetFileProvider request)
 {
     CampaignTargetFileProvider response = new CampaignTargetFileProvider();
     try
     {
         using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context())
         {
             ctx.Configuration.ProxyCreationEnabled = false;
             if (request != null)
             {
                 response = ctx.CampaignTargetFileProviders.Find(request.CampaignId);
             }
             ctx.Configuration.ProxyCreationEnabled = true;
         }
     }
     catch (Exception ex)
     {
         Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaigTargetFileInq");
         throw;
     }
     return response;
 }
 public List<CampaignTargetFileProvider> CampaigTargetFileInfo(CampaignTargetFileProvider request)
 {
     List<CampaignTargetFileProvider> response = new List<CampaignTargetFileProvider>();
     try
     {
         using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context())
         {
             if (request != null && request.CampaignId != 0)
             {
                 response = (from campaignTargetFileProvider in ctx.CampaignTargetFileProviders
                             where campaignTargetFileProvider.CampaignId == request.CampaignId
                             select campaignTargetFileProvider).ToList();
             }
         }
     }
     catch (Exception ex)
     {
         Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaigTargetFileInfo");
         throw;
     }
     return response;
 }
        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;
            }
        }
        public JsonResult SaveCampaignTargetFileProvider(ACM.Model.CampaignTargetFileProvider CmpTargetFileProvider)
        {
            CampaignTargetFileProvider campaignTargetFileProvider = new CampaignTargetFileProvider();
            CmpTargetFileProvider.CampaignId = Convert.ToInt32(Session["CampaignId"]);
            campaignTargetFileProvider = campaignServiceClient.CampaigTargetFileInq(CmpTargetFileProvider);

            string loginId = Utility.LoginId(User.Identity.Name);
            ACM.BO.Admin.UsersBO usersBO = new ACM.BO.Admin.UsersBO();
            var userDetail = usersBO.GetUserDetail(loginId);
            CmpTargetFileProvider.ModifiedBy = userDetail.UserId;
            CmpTargetFileProvider.ModifiedDate = DateTime.Now;
            CmpTargetFileProvider.CreatedDate = DateTime.Now;

            if (campaignTargetFileProvider == null)
            {
               // CmpTargetFileProvider.CampaignId = Convert.ToInt32(Session["CampaignId"]);
                CmpTargetFileProvider.CreatedBy = userDetail.UserId;
                CmpTargetFileProvider.CreatedDate = DateTime.Now;
                campaignServiceClient.CampaigTargetFileAdd(CmpTargetFileProvider);
                return Json(CmpTargetFileProvider);
            }
            else
            {
                campaignServiceClient.CampaigTargetFileMod(CmpTargetFileProvider);
                return Json(CmpTargetFileProvider);
            }
        }
        public ActionResult CampaignTargetFileProvider(ACM.Model.CampaignTargetFileProvider cmpTargetFileProvider)
        {
            ACM.Model.CampaignTargetFileProvider CampTargetFileProvider = new ACM.Model.CampaignTargetFileProvider();
            CampTargetFileProvider.CampaignId = Convert.ToInt32(cmpTargetFileProvider.CampaignId);

            var campaignTargetFileProvider = campaignServiceClient.CampaigTargetFileInq(CampTargetFileProvider);

            if (campaignTargetFileProvider == null)
            {
                campaignTargetFileProvider = new Model.CampaignTargetFileProvider();
                campaignTargetFileProvider.CampaignId = CampTargetFileProvider.CampaignId;
            }

            return PartialView(campaignTargetFileProvider);
        }
 public string CampaigTargetFileMod(CampaignTargetFileProvider request)
 {
     try
     {
         using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context())
         {
             ctx.Entry(request).State = EntityState.Modified;
             ctx.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaigTargetFileMod");
         throw;
     }
     return "Successfully updated";
 }
Exemple #12
0
        public string CampaigTargetFileMod(CampaignTargetFileProvider request)
        {
            try
            {

                return campaignProxy.CampaigTargetFileMod(request);
            }
            catch (Exception exp)
            {
                WCFFaultException.GetClientException(exp, "CampaigTargetFileMod");
                throw new Exception(exp.ToString());
            }
        }
 public CampaignTargetFileProvider CampaigTargetFileInq(CampaignTargetFileProvider request)
 {
     return campaignTargetFileProviderDAO.CampaigTargetFileInq(request);
 }
 public List<CampaignTargetFileProvider> CampaigTargetFileInfo(CampaignTargetFileProvider request)
 {
     return campaignTargetFileProviderDAO.CampaigTargetFileInfo(request);
 }
 public string CampaigTargetFileDel(CampaignTargetFileProvider request)
 {
     return campaignTargetFileProviderDAO.CampaigTargetFileDel(request);
 }