예제 #1
0
        protected void ucIDetail_ChildListInstanceRowDeleting(object sender, InstanceRowDeletingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                switch ((InstanceTypes)Enum.Parse(typeof(InstanceTypes), e.InstanceType))
                {
                case InstanceTypes.Activity:
                    ActivityFacade facade = new ActivityFacade(uow);
                    IFacadeUpdateResult <ActivityData> result = facade.DeleteActivity(e.Instance.Id);
                    e.IsSuccessful = result.IsSuccessful;

                    if (result.IsSuccessful)
                    {
                        // Refresh data in session
                        CurrentInstance.Activitys = facade.RetrieveActivitysByEmployee(CurrentInstance.Id, new ActivityConverter());
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result.ValidationResult, result.Exception);
                    }
                    break;
                }
            }
        }
예제 #2
0
 private void RetrieveInstances(ActivityFacade facade)
 {
     if (CurrentUserContext.IsAdmin)
     {
         CurrentInstances = facade.RetrieveAllActivity(new ActivityConverter());
     }
     else if (CurrentUserContext.IsEmployee)
     {
         CurrentInstances = facade.RetrieveActivitysByEmployee(CurrentUserContext.User.MatchId, new ActivityConverter());
     }
 }