示例#1
0
        public JsonResult GetSDUs(string sidx, string sord, int page, int rows)  //Gets the todo Lists.
        {
            #region MyRegion
            int pageIndex = Convert.ToInt32(page) - 1;
            int pageSize  = rows;
            // FinanceToolEntities2 db = new FinanceToolEntities2();
            LOB oB         = new LOB();
            var SduResults = db.Usp_GetSDUMasterDetails().Select(
                sdu => new
            {
                sdu.SDUID,
                sdu.SDUName,
                sdu.LOBName,
                sdu.Modifiedby,
                sdu.Createdby,
                sdu.ModifiedDate,
                sdu.Createddate
            }).ToList();
            int totalRecords = SduResults.Count();
            var totalPages   = (int)Math.Ceiling((float)totalRecords / (float)rows);

            var customerResults2 = SduResults.OrderByDescending(s => s.SDUName);

            var customerResults3 = customerResults2.Skip(pageIndex * pageSize).Take(pageSize);
            var jsonData         = new
            {
                total = totalPages,
                page,
                records = totalRecords,
                rows    = customerResults3
            };
            return(Json(jsonData, JsonRequestBehavior.AllowGet));

            #endregion
        }
示例#2
0
        public IHttpActionResult PutLOB(int id, LOB lOB)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != lOB.ID)
            {
                return(BadRequest());
            }

            db.Entry(lOB).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LOBExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            LOB lob = db.LOBs.Find(id);

            db.LOBs.Remove(lob);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
        public ActionResult AddLOB(LOB lob)
        {
            FinanceToolEntities FinanceToolEntities2 = new FinanceToolEntities();

            lob.Createddate = System.DateTime.Now;
            FinanceToolEntities2.LOBs.Add(lob);
            FinanceToolEntities2.SaveChanges();
            return(View("GetLOB"));
        }
        //
        // GET: /LOB/Delete/5

        public ActionResult Delete(int id = 0)
        {
            LOB lob = db.LOBs.Find(id);

            if (lob == null)
            {
                return(HttpNotFound());
            }
            return(View(lob));
        }
 public ActionResult Edit(LOB lob)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lob).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(lob));
 }
        public ActionResult Create(LOB lob)
        {
            if (ModelState.IsValid)
            {
                db.LOBs.Add(lob);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(lob));
        }
示例#8
0
        public IHttpActionResult GetLOB(int id)
        {
            LOB lOB = db.LOB.Find(id);

            if (lOB == null)
            {
                return(NotFound());
            }

            return(Ok(lOB));
        }
示例#9
0
        public IHttpActionResult PostLOB(LOB lOB)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LOB.Add(lOB);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = lOB.ID }, lOB));
        }
示例#10
0
        public IHttpActionResult DeleteLOB(int id)
        {
            LOB lOB = db.LOB.Find(id);

            if (lOB == null)
            {
                return(NotFound());
            }

            db.LOB.Remove(lOB);
            db.SaveChanges();

            return(Ok(lOB));
        }
示例#11
0
        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);
        }
示例#12
0
        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);
        }