public bool AddLocationByPipeline(List <LocationsDTO> locList)
        {
            foreach (var item in locList)
            {
                Location loc = new Location()
                {
                    CreatedDate       = DateTime.Now,//item.CreatedDate,
                    Name              = item.Name,
                    Identifier        = item.Identifier,
                    PropCode          = item.PropCode,
                    RDUsageID         = item.RDUsageID,
                    PipelineID        = item.PipelineID,
                    IsActive          = true,
                    CreatedBy         = item.CreatedBy,
                    ModifiedBy        = item.ModifiedBy,
                    ModifiedDate      = DateTime.Now,      //item.ModifiedDate,
                    PipeDuns          = item.PipelineDuns, // adding pipeduns is pending
                    TransactionTypeId = 0
                };
                DbContext.Locations.Add(loc);
            }

            DbContext.SaveChanges();

            return(true);
        }
Beispiel #2
0
        public bool SaveUserPermissions(UserPipelineDTO userMapping)
        {
            string userID = (userMapping.userPipelineMappingDTO.Count > 0 && !string.IsNullOrEmpty(userMapping.userPipelineMappingDTO.Select(u => u.UserId).FirstOrDefault()) ? userMapping.userPipelineMappingDTO[0].UserId : userMapping.UserId);


            var userPipelineMapping = factory.Parse(userMapping);

            if (userMapping != null)
            {
                var deleteUser = dbcontext.UserPipelineMappings.Where(a => a.userId == userID).Select(a => a).ToList();
                var Delete     = dbcontext.UserPipelineMappings.RemoveRange(deleteUser);
                dbcontext.SaveChanges();
                var OnlyNomsOrUprd = userPipelineMapping
                                     .Where(a => a.IsNoms == true || a.IsUPRD == true)
                                     .Select(a => a).ToList();
                var result  = dbcontext.UserPipelineMappings.AddRange(OnlyNomsOrUprd);
                var Success = dbcontext.SaveChanges();
                if (Success > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
        public void AppLogManager(string source, string type, string errMsg)
        {
            ApplicationLog log = new ApplicationLog();

            log.Source      = source.ToString();
            log.Type        = type;
            log.Description = errMsg.ToString();
            log.CreatedDate = DateTime.Now;
            DbContext.ApplicationLogs.Add(log);
            DbContext.SaveChanges();
        }
Beispiel #4
0
        public int AddWatchListRule(int watchListId, WatchListRule watchListRule)
        {
            WatchlistRule newRule = new WatchlistRule()
            {
                WatchlistId        = watchListId,
                ColumnId           = watchListRule.PropertyId,
                OperatorId         = watchListRule.ComparatorsId,
                RuleValue          = watchListRule.value,
                PipelineDuns       = watchListRule.PipelineDuns,
                LocationIdentifier = watchListRule.LocationIdentifier,
                IsCriticalNotice   = watchListRule.IsCriticalNotice,
                AlertSent          = watchListRule.AlertSent,
                AlertFrequency     = (int)watchListRule.AlertFrequency,
                UpperRuleValue     = watchListRule.UpperValue
            };

            DbContext.WatchlistRules.Add(newRule);
            DbContext.SaveChanges();
            return(newRule.Id);
        }
        public IHttpActionResult PutDashNominationStatu(Guid TransactionId, int statusId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var obj = db.DashNominationStatus.Where(a => a.TransactionId == TransactionId).FirstOrDefault();

            if (obj == null)
            {
                return(BadRequest());
            }
            obj.StatusId = statusId;
            switch (statusId)
            {
            case 1:
            case 2:
            case 3:
            case 4:
                obj.NomStatus = "In-Process";
                break;

            case 5:
                obj.NomStatus = "Submitted";
                break;

            case 7:
                obj.NomStatus = "Accepted";
                break;

            case 8:
            case 9:
                obj.NomStatus = "Exception Occured";
                break;

            case 10:
                obj.NomStatus = "Rejected";
                break;

            case 0:
                obj.NomStatus = "GISB Unprocessed";
                break;

            default:
                obj.NomStatus = "Not Defined";
                break;
            }
            db.Entry(obj).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DashNominationStatuExists(TransactionId))
                {
                    ApplicationLog log = new ApplicationLog();
                    log.CreatedDate = DateTime.Now;
                    log.Description = "Nomination not found TransactionId:- " + TransactionId;
                    log.Source      = "Update";
                    log.Type        = "Error";
                    db.ApplicationLogs.Add(log);
                    db.SaveChanges();
                    return(NotFound());
                }
                else
                {
                    return(Ok("fail"));
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }