コード例 #1
0
        private List <BudTaskResource> GetAllRes(string prjId, int version)
        {
            List <BudTaskResource> list = (from taskRes in this
                                           join task in this.tSer on taskRes.TaskId equals task.TaskId
                                           where (task.PrjId == prjId) && (task.TaskType == "")
                                           select taskRes).ToList <BudTaskResource>();
            BudModifyTaskResService service  = new BudModifyTaskResService();
            BudModifyTaskService    service2 = new BudModifyTaskService();
            BudModifyService        service3 = new BudModifyService();

            using (List <BudModifyTaskRes> .Enumerator enumerator = (from mtr in service
                                                                     join mt in service2 on mtr.ModifyTaskId equals mt.ModifyTaskId
                                                                     join m in service3 on mt.ModifyId equals m.ModifyId
                                                                     where (m.PrjId == prjId) && (m.Flowstate == 1)
                                                                     select mtr).ToList <BudModifyTaskRes>().GetEnumerator())
            {
                BudModifyTaskRes modifyTaskRes;
                while (enumerator.MoveNext())
                {
                    modifyTaskRes = enumerator.Current;
                    BudModify     byId = service3.GetById(modifyTaskRes.ModifyId);
                    BudModifyTask task = (from mts in service2
                                          where mts.ModifyTaskId == modifyTaskRes.ModifyTaskId
                                          select mts).FirstOrDefault <BudModifyTask>();
                    BudTaskResource item = new BudTaskResource {
                        TaskResourceId = modifyTaskRes.ModifyTaskResId
                    };
                    if (task.ModifyType == 0)
                    {
                        item.TaskId = modifyTaskRes.ModifyTaskId;
                    }
                    else
                    {
                        item.TaskId = task.TaskId;
                    }
                    item.ResourceId       = modifyTaskRes.ResourceId;
                    item.ResourceQuantity = new decimal?(modifyTaskRes.ResourceQuantity);
                    item.ResourcePrice    = new decimal?(modifyTaskRes.ResourcePrice);
                    item.InputDate        = DateTime.Now;
                    item.InputUser        = byId.InputUser;
                    item.PrjGuid          = prjId;
                    item.Versions         = new int?(version);
                    list.Add(item);
                }
            }
            return(list);
        }
コード例 #2
0
 public void UpdateTotal2(string modifyTaskId)
 {
     try
     {
         BudModifyTask           byId    = this.GetById(modifyTaskId);
         BudModifyTaskResService service = new BudModifyTaskResService();
         decimal        num  = 0M;
         List <decimal> list = (from r in service
                                where r.ModifyTaskId == modifyTaskId
                                select r.ResourcePrice * r.ResourceQuantity).ToList <decimal>();
         if (list != null)
         {
             num = ((IEnumerable <decimal>)list).Sum();
         }
         byId.Total2 = new decimal?(num);
         base.Update(byId);
         new BudTaskService().UpdateTotal2Up(byId.ParentId);
     }
     catch (Exception exception)
     {
         string title = string.Format("BudModifyTaskService.UpdateTotal2({0})", modifyTaskId);
         Log4netHelper.Error(exception, title, "bery");
     }
 }