public ActionResult AddRowReload(int CID)
        {
            //RatingsViewModel RatingModel = new RatingsViewModel();

            RatingsViewModel RatingModel = (RatingsViewModel)TempData["SearchedResults"];

            RatingRecord NewRec = GetSupplierDataByCID(CID, RatingModel.SiteID.Value);

            RatingModel.RatingRecords.Add(NewRec);

            TempData["SearchedResults"] = RatingModel;
            //List<RatingRecord> Records = new List<RatingRecord>();

            //ViewBag.newIndex = count;
            //for(int i =0;i<count; i++)
            //{
            //    RatingRecord empRec = new RatingRecord();
            //    empRec.CID = 0;
            //    Records.Add(empRec);

            //}

            //Records.Add(NewRec);

            //RatingModel.RatingRecords = Records;

            //return PartialView("_AppendRow", RatingModel);
            var rateSuppliers = RatingModel.RatingRecords.Select(r => new SelectListItem {
                Text = r.SupplierName + " CID:" + r.CID, Value = r.CID.ToString()
            }).ToList();

            ViewBag.RatingSuppliers = rateSuppliers;
            return(PartialView("_SupplierRatings", RatingModel));
        }
        public JsonResult UpdateRecord(int CID, string Name, int Rowid)
        {
            List <RatingRecord> Records = (List <RatingRecord>)TempData["RatingRecords"];

            RatingRecord OldRec = new RatingRecord();

            RatingRecord UpdatedRec = new RatingRecord();

            OldRec = Records.Where(r => r.ExcelDiferentiatorID.Equals(Rowid)).FirstOrDefault();

            UpdatedRec = Records.Where(r => r.ExcelDiferentiatorID.Equals(Rowid)).FirstOrDefault();

            Records.Remove(OldRec);

            List <ErrorDetails> ErrorInfo = new List <ErrorDetails>();

            UpdatedRec.CID          = CID;
            UpdatedRec.DUNS         = GetDUNSfromCID(CID);
            UpdatedRec.SupplierName = Name;
            UpdatedRec.Temp_Upload_ = true;
            UpdateErrors(UpdatedRec, ErrorInfo);

            Records.Add(UpdatedRec);
            //RatingRecord

            TempData["RatingRecords"] = Records;

            return(Json(UpdatedRec, JsonRequestBehavior.AllowGet));
        }
        private static void GetErrors(RatingRecord item, List <ErrorDetails> ErrorInfo)
        {
            string msgSupplierName = string.Empty;
            string msgErp          = string.Empty;
            string msgCid          = string.Empty;
            string msgDuns         = string.Empty;

            msgSupplierName = string.Format("ERPSupplierID={0} ,CID={1} and Duns={2} are not matching", new string[] { Convert.ToString(item.ERP_Supplier_ID),
                                                                                                                       Convert.ToString(item.CID), Convert.ToString(item.DUNS) });
            ErrorInfo.Add(new ErrorDetails {
                Key = Convert.ToString(item.SupplierName), ErrorMessage = msgSupplierName
            });

            msgErp = string.Format("ERPSupplierID={0} is not valid", new string[] { Convert.ToString(item.ERP_Supplier_ID) });
            ErrorInfo.Add(new ErrorDetails {
                Key = Convert.ToString(item.ERP_Supplier_ID), ErrorMessage = msgErp
            });

            msgCid = string.Format("CID={0} is not valid", new string[] { Convert.ToString(item.CID) });
            ErrorInfo.Add(new ErrorDetails {
                Key = Convert.ToString(item.CID), ErrorMessage = msgCid
            });

            msgDuns = string.Format("Duns={0} is not valid", new string[] { Convert.ToString(item.DUNS) });
            ErrorInfo.Add(new ErrorDetails {
                Key = Convert.ToString(item.DUNS), ErrorMessage = msgDuns
            });

            item.ErrorInformation = ErrorInfo;
        }
        public async Task OnReceived(ITweetDTO tweet)
        {
            try
            {
                double?sentimentValue = await sentiment.Measure(tweet.Text).ConfigureAwait(false);

                ITweet tweetItem = Tweet.GenerateTweetFromDTO(tweet);
                var    saveTask  = Task.Run(() => persistency?.Save(tweetItem, sentimentValue));
                var    rating    = new RatingRecord(tweet.Id.ToString(), DateTime.UtcNow, sentimentValue);
                foreach (IKeywordTracker tracker in Trackers)
                {
                    tracker.AddRating(tweet.Text, rating);
                }

                if (users.Contains(tweet.CreatedBy.Name))
                {
                    manager.Resolve(tweet.CreatedBy.Name, "User").AddRating(rating);
                }

                await saveTask.ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Failed processing");
            }
        }
예제 #5
0
        public void AddRating(string text, RatingRecord record)
        {
            if (!text.Contains(Keyword, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            Tracker.AddRating(record);
        }
        private static void UpdateErrors(RatingRecord item, List <ErrorDetails> ErrorInfo)
        {
            string msgSupplierName = string.Empty;

            msgSupplierName = "Record passed primary key validation";
            ErrorInfo.Add(new ErrorDetails {
                Key = Convert.ToString(item.SupplierName), ErrorMessage = msgSupplierName
            });

            item.ErrorInformation = ErrorInfo;
        }
예제 #7
0
        public JsonResult UpdateRating(int CID, int Inbound, int OTR, int OTD, int PFR, double PPM, double IPM, double PCT)
        {
            //RatingsViewModel RatingModel = new RatingsViewModel();

            RatingsViewModel RatingModel = (RatingsViewModel)TempData["SearchedResults"];

            RatingRecord Rec = RatingModel.RatingRecords.Where(r => r.CID.Equals(CID)).Select(r =>
            {
                r.Inbound_parts = Inbound;
                r.IPM           = IPM; r.OTD = OTD; r.OTR = OTR; r.PCT = PCT; r.PFR = PFR; r.PPM = PPM; return(r);
            }).FirstOrDefault();


            TempData["SearchedResults"] = RatingModel;


            return(Json(true, JsonRequestBehavior.AllowGet));
        }
예제 #8
0
        private RatingRecord GetSupplierDataByCID(int CID, int SiteID)
        {
            RatingRecord   Rec  = new RatingRecord();
            SelectSiteGDIS gdis = selectGDIS.Where(g => g.SiteID.Equals(SiteID)).FirstOrDefault();

            using (Repository Rep = new Repository())
            {
                Rec = (from site in Rep.Context.SPFS_SITES
                       join spend in Rep.Context.SPFS_SPEND_SUPPLIERS on site.SiteID equals spend.SiteID
                       join sup in Rep.Context.SPFS_SUPPLIERS on spend.CID equals sup.CID
                       where spend.SiteID == SiteID && spend.CID == CID
                       select new RatingRecord
                {
                    CID = spend.CID,
                    SiteID = spend.SiteID,
                    Gdis_org_entity_ID = site.Gdis_org_entity_ID,
                    Gdis_org_Parent_ID = site.Gdis_org_Parent_ID,
                    Reject_incident_count = spend.Reject_incident_count,
                    Reject_parts_count = spend.Reject_parts_count,
                    SupplierName = sup.Name,
                    DUNS = sup.Duns
                }).FirstOrDefault();


                if (Rec == null)
                {
                    Rec = (from sup in Rep.Context.SPFS_SUPPLIERS
                           where sup.CID == CID
                           select new RatingRecord
                    {
                        CID = sup.CID,
                        SiteID = SiteID,
                        Gdis_org_entity_ID = gdis.Gdis_org_entity_ID,
                        Gdis_org_Parent_ID = gdis.Gdis_org_Parent_ID,
                        Reject_incident_count = 0,
                        Reject_parts_count = 0,
                        SupplierName = sup.Name,
                        DUNS = sup.Duns
                    }).FirstOrDefault();
                }
            }
            return(Rec);
        }
        public JsonResult RemoveRecord(int Rowid)
        {
            List <RatingRecord> Records = (List <RatingRecord>)TempData["RatingRecords"];

            RatingRecord RemoveRec = new RatingRecord();

            RemoveRec = Records.Where(r => r.ExcelDiferentiatorID.Equals(Rowid)).FirstOrDefault();

            Records.Remove(RemoveRec);

            // UpdatedRecords = Records;
            //RatingRecord

            TempData["RatingRecords"] = Records;



            return(Json(true, JsonRequestBehavior.AllowGet));
        }
예제 #10
0
        private void InsertRating(RatingRecord rating)
        {
            string sql = $"INSERT INTO {RatingsTable} VALUES({rating.VideoId}, {(int) rating.Type}, {rating.Value})";

            ExecuteNonQuery(sql);
        }