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