1 #region ÉùÃ÷ÈÝÆ÷ ¹«Ë¾¿Í»§¹ÜÀí IBussinessCustomerManage BussinessCustomerManage { get; set; } Ê¡ÊÐÇø¹ÜÀí ICodeAreaManage CodeAreaManage { get; set; } ´óÊý¾Ý×ֶιÜÀí IContentManage ContentManage { get; set; } ±àÂë¹ÜÀí ICodeManage CodeManage { get; set; } 18 #endregion
4¡¢ÎÒÃÇΪIndexÌí¼ÓÊÓͼ£¬²¢ÇÒ¼ÓÈëÑé֤ģ¿é Ä£¿é±ðÃûΪ BussinessCustomer ²Ù×÷Ñé֤Ϊ View
¿Í»§¹ÜÀí¼ÓÔØÖ÷Ò³ [UserAuthorizeAttribute(ModuleAlias = , OperaAction = )] 6 public ActionResult Index() 7 { 8 9 }
5¡¢ÎÒÃÇÌí¼Ó²Ëµ¥Á¬½Ó
5.1 ÎÒÃÇ´ò¿ª ϵͳ¹ÜÀíÖÐÐÄ → ϵͳ¹ÜÀí → Ä£¿é¹ÜÀí Ìí¼ÓÒ»¸ö¶¥²¿·ÖÀà ¡¾¿Í»§¹ÜÀíÖÐÐÄ¡¿
5.2 ÎÒÃÇÔÚ¡¾¿Í»§¹ÜÀíÖÐÐÄ¡¿ ÏÂн¨Ò»¸ö ÓҲඥ¼¶²Ëµ¥ ¡¾¿Í»§¹ÜÀí¡¿
5.3 ÎÒÃÇÔÚ¡¾¿Í»§¹ÜÀí¡¿²Ëµ¥Ï Ð½¨Ò»¸ö²Ëµ¥ ¡¾¿Í»§ÖÐÐÄ¡¿ Ä£¿é±ðÃû£º BussinessCustomer Ä£¿éÀàÐÍ£º ÁбíÒ³ Ä£¿é·¾¶£º /Sys/BussinessCustomer
5.4 ÕâÑùÎÒÃÇÊÇ·ñ¾ÍÓв˵¥ÁËÄØ£¿´ð°¸ÊÇ·ñ¶¨µÄ¡£ÒòΪÎÒÃÇΪIndexÌí¼ÓÁËȨÏÞÑéÖ¤ View ¶øÎÒÃÇÕâ¸öÄ£¿é»¹Ã»ÓÐȨÏÞ¡£ËùÒÔÎÒÃÇÒª´´½¨È¨ÏÞ
ΪÁË¿ìËÙ£¬ÎÒÃÇ¿ÉÒÔÖ±½ÓÑ¡Ôñ ¡¾³õʼ»¯È¨ÏÞ¡¿ »á×Ô¶¯ÎªÎÒÃÇÌí¼Ó »ù±¾µÄ²Ù×÷ȨÏÞ Èç¹ûÎÒÃÇÐèÒªÆäËüȨÏÞ ±ÈÈ磺ÉóºË¡¢·¢²¼¡¢ÏÂÔØ¡¢µ¼³öµÈ£¬ÎÒÃÇ¿ÉÒÔͨ¹ý¡¾´´½¨ÐÂȨÏÞ¡¿ À´Ìí¼Ó×Ô¶¨Òå²Ù×÷ȨÏÞ
OK£¬ÏÖÔÚ¿ÉÒÔ´ò¿ªÒ³ÃæÁË¡£
6¡¢ÐÞ¸ÄIndex Êä³ö¿Í»§Áбí
6.1 Êä³öÊ¡·ÝÁбíºÍ¿Í»§ÀàÐÍÁбí
] = CodeAreaManage.LoadListAll(p => p.LEVELS == 1); ).OrderBy(p => p.SHOWORDER).ToList();
6.2 ´¦Àí²éѯ²ÎÊý Êä³ö¿Í»§Áбí
¿Í»§¹ÜÀí¼ÓÔØÖ÷Ò³ [UserAuthorizeAttribute(ModuleAlias = , OperaAction = )] 6 public ActionResult Index() 7 { { ´¦Àí²éѯ²ÎÊý Province = Request.QueryString[]; ] = Province; CustomerStyle = Request.QueryString[]; ] = CustomerStyle; ViewBag.Search = base.keywords; ViewData[] = CodeAreaManage.LoadListAll(p => p.LEVELS == 1); ).OrderBy(p => p.SHOWORDER).ToList(); View(BindList(Province, CustomerStyle)); 27 } 28 catch (Exception e) 29 { , e); 31 throw e.InnerException; 32 } 33 }
6.3 ·ÖÒ³²éѯ¿Í»§ÁÐ±í·½·¨
1 #region °ïÖú·½·¨¼°ÆäËû¿ØÖÆÆ÷µ÷Óà ·ÖÒ³²éѯ¹«Ë¾¿Í»§Áбí Common.PageInfo BindList(string Province, string CustomerStyle) 6 { query = this.BussinessCustomerManage.LoadAll(null); (!CurrentUser.IsAdmin) 12 { 13 query = query.Where(p => p.Fk_DepartId == CurrentUser.DptInfo.ID); 14 } (!string.IsNullOrEmpty(Province)) 18 { 19 query = query.Where(p => p.CompanyProvince == Province); 20 } (!string.IsNullOrEmpty(CustomerStyle)) 24 { 25 int styleId = int.Parse(CustomerStyle); 26 query = query.Where(p => p.CustomerStyle == styleId); 27 } (!string.IsNullOrEmpty(keywords)) 31 { 32 keywords = keywords.ToLower(); 33 query = query.Where(p => p.CompanyName.Contains(keywords) || p.ChargePersionName.Contains(keywords)); 34 } query = query.OrderByDescending(p => p.UpdateDate).OrderByDescending(p => p.ID); result = this.BussinessCustomerManage.Query(query, page, pagesize); list = result.List.Select(p => new 41 { 42 p.ID, 43 p.CompanyName, 44 p.IsValidate, 45 CompanyProvince = this.CodeAreaManage.Get(m => m.ID == p.CompanyProvince).NAME, 46 CompanyCity = this.CodeAreaManage.Get(m => m.ID == p.CompanyCity).NAME, 47 CompanyArea = this.CodeAreaManage.Get(m => m.ID == p.CompanyArea).NAME, 48 p.CompanyTel, 49 p.ChargePersionName, 50 p.CreateUser, ), 52 p.CustomerStyle }).ToList(); Common.PageInfo(result.Index, result.PageSize, result.Count, Common.JsonConverter.JsonClass(list)); 58 }59 #endregion
6.4 Ò³ÃæÊä³ö
7¡¢Ìí¼Ó¡¢Ð޸ġ¢É¾³ý¿Í»§
7.1 ¼ÓÔØ¿Í»§ÏêÇé Éú³É±íµ¥
¡¡