public ActionResult PerformanceRateUnit(string unitName, string year, string month)
        {
            if (!IsPasswordAvailable())
            {//密码失效 重新登录
                return(ReloginForCurrentUser());
            }
            var guidAndIps = new Dictionary <string, string>();
            var projs      = GetProjects4CurrentUser();

            foreach (var proj in projs)
            {
                var guid = proj.Vault.Guid;
                var ip   = proj.Vault.Server.LocalIp;
                if (guidAndIps.ContainsKey(guid))
                {
                    Log.Error("已存在相同guid的库:" + guid);
                    continue;
                }
                guidAndIps.Add(guid, ip);
            }
            //登录库 查询数据
            var list     = new List <UnitPerformaceModel>();
            var username = AuthUtility.GetUserName(User);
            var pwd      = AuthUtility.GetUserPassword(User);

            if (username != null && pwd != null)
            {
                try
                {
                    var performRate = new MFilesPerformService();
                    list = performRate.GetPerformRateUnit(guidAndIps, username, pwd, int.Parse(year), int.Parse(month), unitName);
                }
                catch (Exception ex)
                {
                    Log.Error(string.Format("Get Unit Performance Rate Data Error: {0}", ex.Message), ex);
                }
            }
            return(View(list.ToPagedList(1, 100000)));
        }
        public ActionResult PerformanceRate(string year, string month)
        {
            if (!IsPasswordAvailable())
            {//密码失效 重新登录
                return(ReloginForCurrentUser());
            }
            if (string.IsNullOrEmpty(year) && string.IsNullOrEmpty(month))
            {
                year  = DateTime.Now.Year.ToString();
                month = DateTime.Now.Month.ToString();
            }
            ViewBag.year0  = year;
            ViewBag.month0 = month;
            Log.Info("履约率查询年份=" + year + "月份=" + month);
            //IEnumerable<Project> allProjects = _projService.GetAllProjects(); //获取所有项目
            var guidAndIps = new Dictionary <string, string>();
            //获取所有项目guid和ip
            var projs = GetProjects4CurrentUser();

            foreach (var proj in projs)
            {
                var guid = proj.Vault.Guid;
                var ip   = proj.Vault.Server.LocalIp;
                if (guidAndIps.ContainsKey(guid))
                {
                    Log.Error("已存在相同guid的库:" + guid);
                    continue;
                }
                guidAndIps.Add(guid, ip);
                Log.Info("履约率查询库:" + proj.Vault.Name);
            }
            //登录库 查询数据
            var list      = new List <PerformanceRateModel>();
            var companies = _projService.GetAllCompany().Select(c => c.Name);

            foreach (string company in companies)
            {
                if (company != "总部机关")
                {
                    list.Add(new PerformanceRateModel {
                        UnitName = company
                    });
                }
            }

            if (!string.IsNullOrEmpty(year) && !string.IsNullOrEmpty(month))
            {
                var username = AuthUtility.GetUserName(User);
                var pwd      = AuthUtility.GetUserPassword(User);
                Log.Info("履约率查询用户名:" + username + "密码:" + pwd);
                if (username != null && pwd != null)
                {
                    try
                    {
                        var performRate = new MFilesPerformService();
                        Log.Info("履约率查询:调用查询程序");
                        list = performRate.GetPerformRate(list, guidAndIps, username, pwd, int.Parse(year), int.Parse(month));
                    }
                    catch (Exception ex)
                    {
                        Log.Error(string.Format("Get Performance Rate Data Error: {0}", ex.Message), ex);
                    }
                }
            }
            return(View(list.ToPagedList(1, 100000)));
        }