コード例 #1
0
ファイル: SelectProjectHelper.cs プロジェクト: zxl881203/src
        public static IList <SelectProject> GetProject(string userCode, IList <string> stateList, string code, string name)
        {
            IList <string>       busiDataId = PrivHelper.GetBusiDataId("project", userCode);
            PTPrjInfoService     service    = new PTPrjInfoService();
            List <SelectProject> first      = new List <SelectProject>();
            int num = (busiDataId.Count / 0x5dc) + 1;

            for (int i = 0; i < num; i++)
            {
                List <string>        theIdList = busiDataId.Skip <string>((i * 0x5dc)).Take <string>(0x5dc).ToList <string>();
                List <SelectProject> second    = (from p in service
                                                  where (((stateList.Contains(p.PrjState.ToString()) && theIdList.Contains(p.PrjGuid.ToString())) && (p.IsValid == "1")) && p.PrjCode.Contains(code)) && p.PrjName.Contains(name)
                                                  select new SelectProject {
                    Id = p.PrjGuid.Value.ToString(), Code = p.PrjCode, Name = p.PrjName, TypeCode = p.TypeCode, OwnerCode = p.OwnerCode.ToString(), Place = p.PrjPlace, State = p.PrjState.Value, Order = p.StartDate.Value.ToString("yyyyMMdd"), IsParent = true
                }).ToList <SelectProject>();
                first = first.Union <SelectProject>(second).ToList <SelectProject>();
            }
            for (int j = 0; j < first.Count; j++)
            {
                SelectProject project = first[j];
                if (project.TypeCode.Length == 10)
                {
                    PTPrjInfo parent = service.GetParent(project.Id);
                    if (parent != null)
                    {
                        project.Order = parent.StartDate.Value.ToString("yyyyMMdd") + project.Order;
                    }
                    if (ExistParent(project.TypeCode, first))
                    {
                        project.IsParent = false;
                    }
                }
                else
                {
                    project.Order = project.Order + "99999999";
                }
            }
            return((from p in first
                    orderby p.Order descending
                    select p).ToList <SelectProject>());
        }
コード例 #2
0
    private void GenerageBudgetByParent(string prjId)
    {
        PTPrjInfoService pTPrjInfoService = new PTPrjInfoService();
        PTPrjInfo        byId             = pTPrjInfoService.GetById(prjId);
        PTPrjInfo        parent           = pTPrjInfoService.GetParent(prjId);
        string           str            = byId.TypeCode.Substring(6, 4);
        BudTaskService   budTaskService = new BudTaskService();

        budTaskService.DeleteByProject(prjId);
        System.Collections.Generic.IList <cn.justwin.Domain.Entities.BudTask> byProject = budTaskService.GetByProject(parent.PrjGuid.Value.ToString(), 999);
        for (int i = 0; i < byProject.Count; i++)
        {
            cn.justwin.Domain.Entities.BudTask budTask = byProject[i];
            budTask.PrjId  = byId.PrjGuid.Value.ToString();
            budTask.TaskId = budTask.TaskId.Substring(0, 9) + str + budTask.TaskId.Substring(13);
            if (!string.IsNullOrEmpty(budTask.ParentId))
            {
                budTask.ParentId = budTask.ParentId.Substring(0, 9) + str + budTask.ParentId.Substring(13);
            }
            budTaskService.Add(budTask);
        }
        this.BindGv();
    }