コード例 #1
0
ファイル: ModelController.cs プロジェクト: weijx-xa/test
        private IEnumerable <Qa> GetQaList(string guid, string classAlias, string state)
        {
            var res = new List <Qa>();

            try
            {
                var server = _mFilesVaultService.GetServer();
                Log.Info("GetQaList-server Ip:" + server.Ip);
                var userName = AuthUtility.GetUserName(User);
                Log.Info("GetQaList-userName:"******"GetQaList-password:"******"GetQaList-vault Guid:" + guid);
                var vault = app.LogInToVault(guid);
                var qas   = MFModelUtil.GetQaList(vault, classAlias, state).ToList();
                Log.Info("GetQaList-qas Count:" + qas.Count);
                res.AddRange(qas);
                vault.LogOutSilent();
                app.Disconnect();
            }
            catch (Exception ex)
            {
                Log.Error("GetQaList:" + ex.Message);
            }
            return(res);
        }
コード例 #2
0
ファイル: ModelController.cs プロジェクト: weijx-xa/test
        IEnumerable <ProjectDto> GetProjects4CurrentUser()
        {
            var list = new List <ProjectDto>();

            try
            {
                var userId = AuthUtility.GetUserId(User);//User.Identity.GetUserId();
                var projs  = _projectMemberService.GetProjectsByUser(userId);
                Log.InfoFormat("用户({0})获取项目总数:{1}", AuthUtility.GetUserName(User), projs.Count);
                foreach (var m in projs)
                {
                    var proj = _projService.GetProjectById(m.ProjectId);
                    if (proj == null)
                    {
                        //    Log.WarnFormat("项目({0})已被删除", m.ProjectId);
                        continue;
                    }
                    var vault = _mfvaultService.GetVaultById(proj.VaultId);
                    if (vault == null)
                    {
                        //   Log.WarnFormat("文档库({0})已被删除", proj.VaultId);
                        continue;
                    }

                    var projDto = proj.ToDto(vault, false);
                    list.Add(projDto);
                }
            }
            catch (Exception ex)
            {
                Log.Error(string.Format("获取用户项目异常:{0}", ex.Message), ex);
            }
            return(list);
        }
コード例 #3
0
        private IEnumerable <VaultKey> GetCurrentVaultsEx()
        {
            var userId     = AuthUtility.GetUserId(User);
            var userName   = AuthUtility.GetUserName(User);
            var password   = DBWorldCache.Get(userId.ToString());
            var isAdUser   = !String.IsNullOrEmpty(AuthUtility.GetUserDomain(User.Identity));
            var server     = _vaultServer.GetServer();
            var vaultGuids = _workHourService.GetCurrentVaults(userName, password, isAdUser, server);

            return(vaultGuids);
        }
コード例 #4
0
        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)));
        }
コード例 #5
0
        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)));
        }
コード例 #6
0
        public ActionResult SupervisorMeetingStatistics(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;

            var guidAndIps = new Dictionary <string, string>();
            var list       = new List <CompanyMeetingStatics>();
            var companies  = _projService.GetAllCompany().Select(c => c.Name);

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

            //获取项目
            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);
            }
            //登录库 查询数据
            if (!string.IsNullOrEmpty(year) && !string.IsNullOrEmpty(month))
            {
                var username = AuthUtility.GetUserName(User);
                var pwd      = AuthUtility.GetUserPassword(User);
                if (username != null && pwd != null)
                {
                    try
                    {
                        list = _mfilesWebService.SupervisorMeetingStatics(list, guidAndIps, username, pwd, year, month);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(string.Format("Get Supervisor Meeting  Data Error: {0}", ex.Message), ex);
                    }
                }
            }

            return(View(list.ToPagedList(1, 100000)));
        }
コード例 #7
0
        public ActionResult GetScheduleControlData(string company, string proj, string projClass, string projLevel, string searchStr)
        {
            if (!IsPasswordAvailable())
            {//密码失效 重新登录
                return(ReloginForCurrentUser());
            }
            var guidAndIps = new Dictionary <string, string>();
            //查询符合条件的项目库
            var projs = GetProjects4CurrentUser();

            foreach (var project in projs)
            {
                if (company != project.Company && company != "所属单位")
                {
                    continue;                                                  //公司
                }
                if (proj != project.Name && proj != "项目")
                {
                    continue;                                       //项目
                }
                if (projClass != project.ProjectClass && projClass != "项目类别")
                {
                    continue;                                                           //项目类别
                }
                if (projLevel != project.Level && projLevel != "项目级别")
                {
                    continue;                                                    //项目等级
                }
                var guid = project.Vault.Guid;
                var ip   = project.Vault.Server.LocalIp;
                if (guidAndIps.ContainsKey(guid))
                {
                    Log.Error("已存在相同guid的库:" + guid);
                    continue;
                }
                guidAndIps.Add(guid, ip);
            }

            //取值
            var username = AuthUtility.GetUserName(User);
            var pwd      = AuthUtility.GetUserPassword(User);
            var list     = new List <ScheduleNode>();

            if (username != null && pwd != null)
            {
                try
                {
                    list = _mfilesWebService.ScheduleControlStatistics(guidAndIps, username, pwd, searchStr);
                }
                catch (Exception ex)
                {
                    Log.Error(string.Format("Get Schedule node  Data Error: {0}", ex.Message), ex);
                }
            }

            //return Json(list, JsonRequestBehavior.AllowGet);
            var json = JsonConvert.SerializeObject(list,
                                                   new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                Formatting        = Newtonsoft.Json.Formatting.None
            });

            return(Content(json));
        }