Ejemplo n.º 1
0
        public BudContractTask GetTaskById(string id)
        {
            BudContractTask task = (from t in this
                                    where t.TaskId == id
                                    select t).FirstOrDefault <BudContractTask>();

            if (task == null)
            {
                BudConModifyTaskService service = new BudConModifyTaskService();
                BudConModifyTask        task2   = (from r in service
                                                   where r.TaskId == id
                                                   select r).FirstOrDefault <BudConModifyTask>();
                if (task2 != null)
                {
                    BudConModify byId = new BudConModifyService().GetById(task2.ModifyId);
                    task = new BudContractTask {
                        TaskId             = task2.TaskId,
                        ParentId           = task2.ParentId,
                        OrderNumber        = task2.OrderNumber,
                        PrjId              = byId.PrjId,
                        TaskCode           = task2.ModifyTaskCode,
                        TaskName           = task2.ModifyTaskContent,
                        Unit               = task2.Unit,
                        Quantity           = task2.Quantity,
                        UnitPrice          = new decimal?(task2.UnitPrice),
                        Total              = new decimal?(task2.Total),
                        StartDate          = task2.StartDate,
                        EndDate            = task2.EndDate,
                        ConstructionPeriod = task2.ConstructionPeriod,
                        Note               = task2.Note,
                        InputDate          = DateTime.Now,
                        InputUser          = byId.InputUser,
                        TaskType           = string.Empty,
                        IsValid            = true
                    };
                }
                return(task);
            }
            BudConModifyTaskService service3 = new BudConModifyTaskService();
            BudConModifyTask        task3    = (from r in service3
                                                where r.TaskId == id
                                                select r).FirstOrDefault <BudConModifyTask>();

            if (task3 != null)
            {
                task.StartDate = task3.StartDate;
                task.EndDate   = task3.EndDate;
                decimal?total = task.Total;
                decimal num   = task3.Total;
                task.Total     = total.HasValue ? new decimal?(total.GetValueOrDefault() + num) : null;
                task.Quantity += task3.Quantity;
            }
            return(task);
        }
Ejemplo n.º 2
0
        public int GetSubCount(string id)
        {
            BudConModifyTaskService service = new BudConModifyTaskService();
            int num = (from t in this
                       where t.ParentId == id
                       select t).Count <BudContractTask>();
            int num2 = (from t in service
                        where (t.ParentId == id) && (t.ModifyType == 0)
                        select t).Count <BudConModifyTask>();

            return(num + num2);
        }