예제 #1
0
        public ActionResult LoadEnableAssignData()
        {
            AjaxResult ar = new Globals.AjaxResult();

            var currentUser = LoginManager.GetCurrentUser();

            try
            {
                var currentUserData = new List <InformationModel>();
                var collectorData   = new List <InformationModel>();

                var currentUserState = _informationBLL.GetInformation(currentUser.Account, InformatinState.UnAssigned, ref currentUserData);
                foreach (var item in _memberBLL.GetUsersByRole(RolesManager.GetRolesCode(RolesCode.Collector.ToString()), currentUser.CompanyCode))
                {
                    var temp      = new List <InformationModel>();
                    var tempstate = _informationBLL.GetInformation(item.Account, InformatinState.UnAssigned, ref temp);
                    collectorData.AddRange(temp);
                }

                currentUserData.AddRange(collectorData);
                if (currentUserData == null || currentUserData.Count <= 0)
                {
                    ar.state   = ResultType.error.ToString();
                    ar.message = "没有获取到可供分配的数据";
                }
                else
                {
                    ar.state = ResultType.success.ToString();
                    ar.data  = currentUserData.ToJson();
                }
            }
            catch (Exception ex)
            {
                LogHelper.writeLog_error(ex.Message);
                LogHelper.writeLog_error(ex.StackTrace);

                ar.state   = ResultType.error.ToString();
                ar.message = "系统错误,无法获取到数据";
            }
            return(Json(ar, JsonRequestBehavior.AllowGet));
        }