Example #1
0
        public JsonResult QueryList(int page, int rows, string ClientName, string SampleName, string AnalysisStatus)
        {
            ProductAnalysis querymodel = new ProductAnalysis()
            {
                PageSize       = rows,
                PageNo         = page,
                ClientName     = ClientName,
                Memberid       = 0,
                SampleName     = SampleName,
                AnalysisStatus = int.Parse(AnalysisStatus)
            };

            PageModel <ProductAnalysis> source = ServiceHelper.Create <IProductAnalysisService>().GetProductAnalysisList(querymodel);
            var array =
                from item in source.Models.ToArray()
                select new
            {
                Id                   = item.Id,
                ClientName           = item.ClientName,
                MemberName           = ServiceHelper.Create <IMemberService>().GetMember(item.Memberid) == null ? "" : ServiceHelper.Create <IMemberService>().GetMember(item.Memberid).UserName,
                ReportHeader         = item.ReportHeader,
                SampleName           = item.SampleName,
                SampleQuantity       = item.SampleQuantity,
                SampleSpecifications = item.SampleSpecifications,
                AnalysisStatus       = item.AnalysisStatus,
                ServiceCharge        = item.ServiceCharge,
                AnalysisAttachments  = item.AnalysisAttachments,
                ClientLinkMan        = item.ClientLinkMan
            };

            return(Json(new { rows = array, total = source.Total }));
        }
Example #2
0
        public void Should_return_likes_number_when_calling_product_liker()
        {
            ProductAnalysis liker = new ProductAnalysis();

            liker.Add(new LikesCounter(liker));
            liker.LikeProduct();
        }
        public JsonResult AddProductAnalysis(string strjson)
        {
            long memberid = 0;

            if (base.CurrentUser == null)
            {
                base.RedirectToAction("Index", "Login", new { area = "Web" });
            }
            else
            {
                memberid = base.CurrentUser.Id;
            }
            try
            {
                ProductAnalysis _ProductAnalysis = Newtonsoft.Json.JsonConvert.DeserializeObject <ProductAnalysis>(strjson);
                _ProductAnalysis.Memberid = memberid;
                ProductAnalysis resutl = ServiceHelper.Create <IProductAnalysisService>().AddProductAnalysis(_ProductAnalysis);
                if (resutl != null && resutl.Id > 0)
                {
                    return(Json(new { success = true }));
                }
                else
                {
                    return(Json(new { success = false, msg = "failed" }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, msg = ex.ToString() }));
            }
        }
Example #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            ProductAnalysis productAnalysis = db.ProductAnalysis.Find(id);

            db.ProductAnalysis.Remove(productAnalysis);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #5
0
        public void Should_return_one_like_when_only_one_like_added()
        {
            ProductAnalysis liker = new ProductAnalysis();

            liker.LikeProduct();
            int numberLikes = liker.GetNumberLikes();

            Check.That(numberLikes).IsEqualTo(1);
        }
        public void Should_return_one_like_when_only_one_like_added()
        {
            ProductAnalysis liker = new ProductAnalysis();

            liker.LikeProduct();
            int numberLikes = liker.GetNumberLikes();

            Assert.AreEqual(1, numberLikes);
        }
Example #7
0
 public ActionResult Edit([Bind(Include = "paid,Product_Name,Product_Quantity")] ProductAnalysis productAnalysis)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productAnalysis).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(productAnalysis));
 }
Example #8
0
        public void Should_return_one_like_when_only_one_like_added()
        {
            ProductAnalysis liker   = new ProductAnalysis();
            LikesCounter    counter = new LikesCounter(liker);
            IProduct        ram     = new Ram(25, "Corsair");

            liker.LikeProduct(ram);

            Assert.AreEqual(1, ram.likeNumber);
        }
Example #9
0
        public void Should_return_likes_number_when_calling_product_liker()
        {
            ProductAnalysis liker = new ProductAnalysis();

            liker.LikeProduct();
            LikesCounter counter    = new LikesCounter(liker);
            int          likeNumber = counter.CountLikes();

            Check.That(likeNumber).IsEqualTo(1);
        }
        public void Should_return_likes_number_when_calling_product_liker()
        {
            ProductAnalysis liker = new ProductAnalysis();

            liker.LikeProduct();
            LikesCounter counter    = new LikesCounter(liker);
            int          likeNumber = counter.CountLikes();

            Assert.AreEqual(1, likeNumber);
        }
Example #11
0
        public ActionResult Detail(long Id)
        {
            ProductAnalysis model = ServiceHelper.Create <IProductAnalysisService>().GetProductAnalysis(Id);

            if (model != null)
            {
                model.MemberName = ServiceHelper.Create <IMemberService>().GetMember(model.Memberid) == null ? "" : ServiceHelper.Create <IMemberService>().GetMember(model.Memberid).UserName;
            }
            return(View(model));
        }
Example #12
0
        public void AnalyseWeekTest()
        {
            // The week number that is expected
            String device = "9360";

            // Obtain the Week analysis
            ProductAnalysis wk33_analysis = Analysis.AnalyseProduct(device);

            // Ensure that the requested week has been recieved
            Assert.AreEqual(device, wk33_analysis.Device);
        }
Example #13
0
        public ActionResult Create([Bind(Include = "paid,Product_Name,Product_Quantity")] ProductAnalysis productAnalysis)
        {
            if (ModelState.IsValid)
            {
                db.ProductAnalysis.Add(productAnalysis);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(productAnalysis));
        }
        /// <summary>
        /// 分析报告列表查询列表
        /// </summary>
        /// <param name="opQuery"></param>
        /// <returns></returns>
        public Model.PageModel <ProductAnalysis> GetProductAnalysisList(ProductAnalysis paQuery)
        {
            int num = 0;
            IQueryable <ProductAnalysis> _ProductAnalysis = context.ProductAnalysis.AsQueryable <ProductAnalysis>();


            if (paQuery.AnalysisStatus != 0)
            {
                _ProductAnalysis =
                    from d in _ProductAnalysis
                    where d.AnalysisStatus.Equals(paQuery.AnalysisStatus)
                    orderby d.Id descending
                    select d;
            }

            if (paQuery.Memberid != 0)
            {
                _ProductAnalysis =
                    from d in _ProductAnalysis
                    where d.Memberid.Equals(paQuery.Memberid)
                    orderby d.Id descending
                    select d;
            }
            if (!string.IsNullOrEmpty(paQuery.ClientName))
            {
                _ProductAnalysis =
                    from d in _ProductAnalysis
                    where d.ClientName.Equals(paQuery.ClientName)
                    orderby d.Id descending
                    select d;
            }

            if (!string.IsNullOrEmpty(paQuery.SampleName))
            {
                _ProductAnalysis =
                    from d in _ProductAnalysis
                    where d.SampleName.Equals(paQuery.SampleName)
                    orderby d.Id descending
                    select d;
            }

            _ProductAnalysis = _ProductAnalysis.GetPage(out num, paQuery.PageNo, paQuery.PageSize, (IQueryable <ProductAnalysis> d) =>
                                                        from o in d orderby o.Id descending select o);

            return(new PageModel <ProductAnalysis>()
            {
                Models = _ProductAnalysis,
                Total = num
            });
        }
Example #15
0
        // GET: ProductAnalysis/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductAnalysis productAnalysis = db.ProductAnalysis.Find(id);

            if (productAnalysis == null)
            {
                return(HttpNotFound());
            }
            return(View(productAnalysis));
        }
        /// <summary>
        /// 更新状态
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public bool UpdateAnalysisStatus(long Id, int status)
        {
            bool            result = false;
            ProductAnalysis model  = context.ProductAnalysis.FindBy((ProductAnalysis item) => item.Id == Id).FirstOrDefault();

            if (model != null)
            {
                model.AnalysisStatus = status;
                int i = context.SaveChanges();
                if (i > 0)
                {
                    result = true;
                }
            }
            return(result);
        }
        /// <summary>
        /// 删除分析鉴定
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public bool Delete(long Id)
        {
            bool            result = false;
            ProductAnalysis model  = context.ProductAnalysis.FindBy((ProductAnalysis item) => item.Id == Id).FirstOrDefault();

            if (model != null)
            {
                context.ProductAnalysis.Remove(model);
                int i = context.SaveChanges();
                if (i > 0)
                {
                    result = true;
                }
            }
            return(result);
        }
        public void Initialise()
        {
            // Create a new KML Reader
            KMLReader reader = new KMLReader(ROOT_DIR + "data\\L_wk32_drops.kml");

            // Read in all call logs
            EventCollection collection = reader.GetCallLogs();

            collection.ForEach(evt => evt.Device = DEVICE);

            // Cluster the call logs
            DBSCAN scan = new DBSCAN(collection);

            scan.Analyse();

            // Initialise the clusters
            Clusters = scan.Clusters;

            // Initialise the analysis
            Analysis = new ProductAnalysis(Clusters, DEVICE);
        }
        /// <summary>
        /// 提交分析报告
        /// </summary>
        /// <param name="op"></param>
        public ProductAnalysis AddProductAnalysis(ProductAnalysis op)
        {
            ProductAnalysis _ProductAnalysis = new ProductAnalysis();

            if (op == null || op.Id != 0)
            {
                return(_ProductAnalysis);
            }
            else
            {
                try
                {
                    _ProductAnalysis = context.ProductAnalysis.Add(op);
                    context.SaveChanges();
                }
                catch (DbEntityValidationException dbEx)
                {
                }

                return(_ProductAnalysis);
            }
        }
Example #20
0
        public ActionResult LowestSellingProduct()
        {
            ProductAnalysis pa = new ProductAnalysis();

            return(View(pa.LowestSellingProduct()));
        }
        /// <summary>
        ///  本品分析
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageNo"></param>
        /// <param name="collection"></param>
        /// <returns></returns>
        public ActionResult ProductState(int? pageNo,string parm,FormCollection collection)
        {
            Dictionary<string, string> sitemaster = GetSiteMaster();
            ViewData["SiteMaster"] = sitemaster;
            int PageNo = pageNo ?? 1;
            int PageSize = 20;
            Dictionary<string, string> dict = ParmHelper.Analysis(collection);
            if (dict.Count == 0)
            {
                Hashtable ht = new Hashtable();
                ht = ParmHelper.AnalysisParmByHt(parm);
                ht.Add("memberID", EnterPriseMemberInfo.MemberID);
                /*foreach (string key in collection.AllKeys)
                {
                    ht[key] = collection[key];
                }*/
                string city = ht["city"] == null ? "" : ht["city"].ToString();
                string level = ht["level"] == null ? "" : ht["level"].ToString();
                ht.Add("cityshow", GetCityRegion(city));
                //ht.Add("city", city);
                //ht.Add("level", level);
                ht.Add("proshow", GetProLv(level));
                ViewData["Query"] = ht;
                if (ht["commonname"] == null || ht["commonname"].ToString() == "")
                {
                    PagedList<ProductState> newList2 = new PagedList<ProductState>(new List<ProductState>(), 1, 1, 0);
                    ViewData["Pa"] = new ProductAnalysis();
                    ViewData["Count"] = 0;
                    return View(newList2);
                }
                if (ht["city"] != null && ht["city"].ToString() != "")
                {
                    ht.Add("provincecodes", ht["city"].ToString().Split('-'));
                }
                if (ht["proshow"] != null && ht["proshow"].ToString() != "")
                {
                    level = level.Trim('-');
                    ht.Add("isprovice", level.Split('-'));
                }
                MyProductAnalysisHelper m = new MyProductAnalysisHelper();
                m.PageSize = PageSize;
                ProductAnalysis pa = new ProductAnalysis();
                int total = 0;
                List<ProductState> list = m.GetListEx(PageNo, ht, ref total, ref pa);
                list.Sort();
                ViewData["Pa"] = pa;
                ViewData["Count"] = total;

                PagedList<ProductState> newList = new PagedList<ProductState>(list, PageNo, PageSize);
                return View(newList);
            }
            else
            {
                string parmeter = ParmHelper.BuildParm(dict);
                return RedirectToAction("ProductState", new { parm = parmeter, id = 1 });
            }
        }
        /// <summary>
        ///  竞品分析
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageNo"></param>
        /// <param name="collection"></param>
        /// <returns></returns>
        public ActionResult CompeteProduct(int? pageNo,string parm, FormCollection collection)
        {
            Dictionary<string, string> sitemaster = GetSiteMaster();
            ViewData["SiteMaster"] = sitemaster;
            int PageNo = pageNo ?? 1;
            int PageSize = 20;
            Dictionary<string, string> dict = ParmHelper.Analysis(collection);
            if (dict.Count == 0)
            {

                Hashtable ht = ParmHelper.AnalysisParmByHt(parm);
                ht.Add("memberID", EnterPriseMemberInfo.MemberID);

                string city = ht["city"] == null ? "" : ht["city"].ToString();
                string level = ht["level"] == null ? "" : ht["level"].ToString();
                ht.Add("cityshow", GetCityRegion(city));
                ht.Add("proshow", GetProLv(level));

                if (ht["city"] != null && ht["city"].ToString() != "")
                {
                    ht.Add("cities", ht["city"].ToString().Split('-'));
                }
                if (ht["proshow"] != null && ht["proshow"].ToString() != "")
                {
                    level = level.Trim('-');
                    ht.Add("isprovice", level.Split('-'));
                }
                //查询项目ID
                DBiddingProjectStandardDao dDao = new DBiddingProjectStandardDao();
                IList<int> projectoids=dDao.GetCompeteAnalysis(ht);
                if (projectoids.Count() > 0)
                {
                    ht.Add("projectids", projectoids.ToArray());
                }

                MemberEnterpriseAliasDao mDao = new MemberEnterpriseAliasDao();
                IList<MemberEnterpriseAlias> enterpriseList = mDao.FindByMemberID(EnterPriseMemberInfo.MemberID);
                if (ht["compete"] != null && !string.IsNullOrEmpty(ht["compete"].ToString()))
                {
                    int count=enterpriseList.Count;
                    string[] productenterprises = new string[count];
                    int i=0;
                    foreach (MemberEnterpriseAlias v in enterpriseList)
                    {
                        productenterprises[i] = v.EnterpriseName;
                        i++;

                    }
                    ht.Add("productenterprises", productenterprises);
                }

                ViewData["Query"] = ht;
                if (projectoids.Count==0|| ht["commonname"] == null || ht["commonname"].ToString() == "")
                {
                    PagedList<ProductState> newList2 = new PagedList<ProductState>(new List<ProductState>(), 1, 1, 0);
                    ViewData["Pa"] = new ProductAnalysis();
                    ViewData["Count"] = 0;
                    return View(newList2);
                }
                else
                {
                    ht.Add("commonnames", ht["commonname"].ToString().Split('|'));
                }

                MyProductAnalysisHelper m = new MyProductAnalysisHelper();
                m.PageSize = PageSize;
                ProductAnalysis pa = new ProductAnalysis();
                int total = 0;
                //List<int> competeMembers = new List<int>();
                //if (ht["compete"] != null && !string.IsNullOrEmpty(ht["compete"].ToString()))
                //{
                //    string[] competes = ht["compete"].ToString().Split('|');
                //    CRMService crmS = new CRMService();
                //    for (int i = 0; i < competes.Length; i++)
                //    {

                //        int id = crmS.GetMemberID(competes[i]);
                //        if (id != 0 && !competeMembers.Contains(id))
                //        {
                //            competeMembers.Add(id);
                //        }
                //    }
                //}
                if (ht["formulation"].ToString() == "注射")
                {
                    ht.Add("formulation1", "注射");
                    if (ht["Formulation2"] != null)
                    {
                        string temp = ht["Formulation2"].ToString().Trim(',');
                        string[] formulation2s = temp.Split(',');
                        ht.Add("formulation2s", formulation2s);
                    }
                }

                List<ProductState> list = m.GetList(PageNo, ht, enterpriseList,ref total, ref pa);
                list.Sort();

                foreach (ProductState p in list)
                {
                    foreach (MemberEnterpriseAlias n in enterpriseList)
                    {
                        if (p.ProductEnterprise == n.EnterpriseName)
                        {
                            p.IsMine = true;
                            break;
                        }
                    }
                }
                list.OrderBy(p => p.CommonName).OrderBy(p => p.Formulation).OrderBy(p => p.ChineseSpecification);
                list.OrderBy(p => new { p.CommonName, p.Formulation, p.ChineseSpecification });
                ViewData["Pa"] = pa;
                ViewData["Count"] = total;
                PagedList<ProductState> newList = new PagedList<ProductState>(list, PageNo, PageSize);
                return View(newList);
            }
            else
            {

                string parmeter = ParmHelper.BuildParm(dict);
                return RedirectToAction("CompeteProduct", new { parm = parmeter, id = 1 });

            }
        }