Esempio n. 1
0
        public ActionResult StoreProjectRowsCount(string _USCode)
        {
            var resultData = new
            {
                ClosureRowsCount     = ClosureInfo.Search(o => o.USCode == _USCode).ToList <ClosureInfo>().Count,
                RenewalRowsCount     = RenewalInfo.Search(o => o.USCode == _USCode).ToList <RenewalInfo>().Count,
                RebuildRowsCount     = RebuildInfo.Search(o => o.USCode == _USCode).ToList <RebuildInfo>().Count,
                MajorLeaseRowsCount  = MajorLeaseInfo.Search(o => o.USCode == _USCode).ToList <MajorLeaseInfo>().Count,
                ReimageRowsCount     = ReimageInfo.Search(o => o.USCode == _USCode).ToList <ReimageInfo>().Count,
                TempClosureRowsCount = TempClosureInfo.Search(o => o.USCode == _USCode).ToList <TempClosureInfo>().Count
            };

            string result = Newtonsoft.Json.JsonConvert.SerializeObject(resultData);

            return(Content(result));
        }
Esempio n. 2
0
        public IHttpActionResult GetMajorLeaseApprovers(string flowCode, string projectId = "")
        {
            if (string.IsNullOrEmpty(flowCode))
            {
                throw new Exception("flowCode is NULL");
            }

            MajorLeaseInfo majorLeaseInfo = null;

            if (!string.IsNullOrEmpty(projectId))
            {
                majorLeaseInfo = MajorLeaseInfo.Search(e => e.ProjectId.Equals(projectId)).FirstOrDefault();
            }
            if (majorLeaseInfo == null)
            {
                throw new Exception("Could not find the Major Lease Info, please check it!");
            }

            var wfEntity  = BaseWFEntity.GetWorkflowEntity(projectId, flowCode);
            var approvers = wfEntity.GetApproveDialogUser();

            var dicUsers = new Dictionary <string, List <SimpleEmployee> >();

            switch (flowCode)
            {
            case FlowCode.MajorLease_LegalReview:

                dicUsers.Add("Legals", new List <SimpleEmployee>()
                {
                    new SimpleEmployee()
                    {
                        Code     = majorLeaseInfo.LegalAccount,
                        NameENUS = majorLeaseInfo.LegalNameENUS,
                        NameZHCN = majorLeaseInfo.LegalNameZHCN
                    }
                });
                break;

            case FlowCode.MajorLease_FinanceAnalysis:
                dicUsers.Add("FMs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Finance_Manager));
                break;

            case FlowCode.MajorLease_ConsInfo:
                dicUsers.Add("ConstructionManagers", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Cons_Mgr));
                dicUsers.Add("MCCLConsManagers", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.MCCL_Cons_Manager));
                break;

            case FlowCode.MajorLease_Package:
                dicUsers.Add("MarketMgrs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Market_Asset_Mgr));
                dicUsers.Add("RegionalMgrs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Regional_Asset_Mgr));
                dicUsers.Add("DDs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Market_DD));
                dicUsers.Add("GMs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.GM));
                dicUsers.Add("FCs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Finance_Controller));
                dicUsers.Add("RDDs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Regional_DD));
                dicUsers.Add("VPGMs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.VPGM));
                dicUsers.Add("CDOs", Employee.GetEmployeesByRole(RoleCode.CDO));
                dicUsers.Add("CFOs", Employee.GetEmployeesByRole(RoleCode.CFO));
                dicUsers.Add("ManagingDirectors", Employee.GetEmployeesByRole(RoleCode.MD));
                break;

            case FlowCode.MajorLease_ConsInvtChecking:
                //dicUsers.Add("FMs", new List<SimpleEmployee>()
                //{
                //    new SimpleEmployee()
                //    {
                //        Code = majorLeaseInfo.FinanceAccount,
                //        NameENUS = majorLeaseInfo.FinanceNameENUS,
                //        NameZHCN = majorLeaseInfo.FinanceNameZHCN
                //    }
                //});
                dicUsers.Add("FMs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Finance_Manager));
                dicUsers.Add("ConstructionManagers", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Cons_Mgr));
                dicUsers.Add("FinanceControllers", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Finance_Controller));
                dicUsers.Add("VPGMs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.VPGM));
                break;

            case FlowCode.MajorLease_GBMemo:
                dicUsers.Add("ConstructionManagers", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.Cons_Mgr));
                break;
            }
            dicUsers.Add("MCCLAssetMgrs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.MCCL_Asset_Mgr));
            dicUsers.Add("MCCLAssetDtrs", Employee.GetStoreEmployeesByRole(majorLeaseInfo.USCode, RoleCode.MCCL_Asset_Director));
            return(Ok(new { dicUsers, approvers }));
        }