コード例 #1
0
        private bool LimitSight(Guid billDemandUid, Guid sighterId, Guid initiatorId, SightingType sightingType,
                                Func<Budget2DataContext, Guid, List<LimitSighter>> sighterSelector)
        {
            bool retval = false;
            using (var scope = ReadCommittedSupressedScope)
            {
                using (var context = this.CreateContext())
                {
                    var sighters = sighterSelector(context, billDemandUid);

                    if (sighters.Count(p => p.SighterId == sighterId) == 0)
                        return false;

                    List<LimitSighter> currentSighters = GetCurrentSighters(context, billDemandUid, sightingType).ConvertAll<LimitSighter>(p => p);

                    foreach (var limitSighter in sighters.Where(p => p.SighterId == sighterId))
                    {
                        var sighter = limitSighter;
                        if (currentSighters.Count(p => p.LimitId == sighter.LimitId && p.SighterId == sighter.SighterId) == 0)
                        {
                            var newSighting = new WorkflowSighting
                            {
                                EntityId = billDemandUid,
                                Id = Guid.NewGuid(),
                                SighterId = sighterId,
                                InitiatorId = initiatorId,
                                SightingType = sightingType.Id,
                                SightingTime = DateTime.Now,
                                ItemId = sighter.LimitId
                            };
                            context.WorkflowSightings.InsertOnSubmit(newSighting);
                            currentSighters.Add(sighter);
                        }
                    }

                    retval =
                        sighters.TrueForAll(
                            p =>
                            currentSighters.FirstOrDefault(s => s.LimitId == p.LimitId && s.SighterId == p.SighterId) !=
                            null);
                    context.SubmitChanges();
                }

                scope.Complete();
            }
            return retval;
        }
コード例 #2
0
        private bool OperativeSight(Guid billDemandUid, Guid sighterId, Guid initiatorId)
        {
            bool retval = false;

            using (var scope = ReadCommittedSupressedScope)
            {
                using (var context = this.CreateContext())
                {
                    var bd = GetBillDemand(context, billDemandUid);

                    if (bd == null)
                        return false;

                    var sdId = EmployeeService.GetIdentityStructDivisionId(sighterId, bd.BudgetId);

                    if (!sdId.HasValue)
                        return false;

                    var sighters = GetLimitManagerSightersOperative(context, bd);

                    if (sighters.Count(p => p.LimitId == sdId.Value) == 0)
                        return false;

                    List<LimitSighter> currentSighters = GetCurrentSighters(context, billDemandUid, SightingType.BillDemandLimitManagerSighting).ConvertAll<LimitSighter>(p => p);

                    foreach (var limitSighter in sighters.Where(p => p.LimitId == sdId.Value))
                    {
                        var sighter = limitSighter;
                        if (currentSighters.Count(p => p.LimitId == sighter.LimitId) == 0)
                        {
                            var newSighting = new WorkflowSighting
                            {
                                EntityId = billDemandUid,
                                Id = Guid.NewGuid(),
                                SighterId = sighterId,
                                InitiatorId = initiatorId,
                                SightingType = SightingType.BillDemandLimitManagerSighting.Id,
                                SightingTime = DateTime.Now,
                                ItemId = sighter.LimitId
                            };
                            context.WorkflowSightings.InsertOnSubmit(newSighting);
                            currentSighters.Add(sighter);
                        }
                    }


                    retval =
                     sighters.TrueForAll(
                         p =>
                         currentSighters.FirstOrDefault(s => s.LimitId == p.LimitId ) !=
                         null);
                    context.SubmitChanges();

                }

                scope.Complete();
            }

            return retval;
        }
コード例 #3
0
		private void detach_WorkflowSightings(WorkflowSighting entity)
		{
			this.SendPropertyChanging();
			entity.SecurityTrustee = null;
		}
コード例 #4
0
 partial void DeleteWorkflowSighting(WorkflowSighting instance);
コード例 #5
0
 partial void UpdateWorkflowSighting(WorkflowSighting instance);
コード例 #6
0
 partial void InsertWorkflowSighting(WorkflowSighting instance);