/// <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 });

            }
        }
Пример #2
0
        public JsonResult ListAll(string product, string userid, string projectid, string formulation, string quality)
        {
            string resulttable = string.Empty;
            int memberid = new MemberUserInfoDao().Find(Int32.Parse(userid)).MemberID;
            Hashtable htparm = new Hashtable();
            htparm["product"] = product;
            htparm["projectid"] = Int32.Parse(projectid);
            htparm["quality"] = quality;
            htparm["formulation"] = formulation;
            string formulationlist = EmedAppraiseMapper.Get().QueryForObject<string>("AuctionGroup.All", htparm);
            string[] flists = formulationlist.Split(',');
            htparm["flists"] = flists;
            IList<IDictionary> list = EmedAppraiseMapper.Get().QueryForList<IDictionary>("AuctionMedicine.Simulate", htparm);
            int count = list.Count;
            MemberEnterpriseAliasDao mDao = new MemberEnterpriseAliasDao();
            IList<MemberEnterpriseAlias> enterpriseList = mDao.FindByMemberID(memberid);
            List<string> enterlist = new List<string>();
            foreach (MemberEnterpriseAlias m in enterpriseList)
            {
                enterlist.Add(m.EnterpriseName);
            }
            foreach (IDictionary l in list)
            {
                if (enterlist.Contains(l["ProductEnterprise"].ToString()))
                {
                    resulttable += "<tr class='tr_bg sort' style='width: 100%;background-color: Silver;'>";
                }
                else
                {
                    resulttable += "<tr class='tr_bg sort' style='width: 100%;'>";
                }

                resulttable += "<td>" + l["CommonName"].ToString() + "</td>";
                resulttable += result(l["Formulation"]);
                resulttable += result(l["ChineseSpecification"]);
                resulttable += result(l["ConvertCoefficient"]);
                resulttable += result(l["Unit"]);
                resulttable += result(l["Packaging"]);
                resulttable += result(l["Material"]);
                resulttable += result(l["QualityLevel"]);
                resulttable += result(l["ProductEnterprise"]);
                resulttable += result(l["LimitPrice"]);
                resulttable += "<td><input size='1' autocomplete='off' type='text' class='Quote' style='margin-left: 8px;'/></td><td class='result'></td></tr>";
            }

            return Json(new { html = resulttable, count = count });
        }