private void childList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
 {
     if (ChildListInstanceRowSaving != null)
     {
         ChildListInstanceRowSaving(this, e);
     }
 }
 protected void ucIDetail_ChildListInstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         switch ((InstanceTypes)Enum.Parse(typeof(InstanceTypes), e.InstanceType))
         {
         case InstanceTypes.Post:
             PostFacade facade      = new PostFacade(uow);
             PostDto    instanceDto = e.Instance as PostDto;
             instanceDto.TopicId = CurrentInstance.Id;
             // Save data
             IFacadeUpdateResult <PostData> result = facade.SavePost(instanceDto);
             e.IsSuccessful = result.IsSuccessful;
             if (result.IsSuccessful)
             {
                 // Refresh data in session
                 CurrentInstance.Posts = facade.RetrievePostsByTopic(CurrentInstance.Id, new PostConverter());
             }
             else
             {
                 ProcUpdateResult(result.ValidationResult, result.Exception);
             }
             break;
         }
     }
 }
 protected void ucIDetail_ChildListInstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         switch ((InstanceTypes)Enum.Parse(typeof(InstanceTypes), e.InstanceType))
         {
         case InstanceTypes.TransactionItem:
             TransactionFacade  facade             = new TransactionFacade(uow);
             TransactionItemDto TransactionItemDto = e.Instance as TransactionItemDto;
             // Save data
             IFacadeUpdateResult <TransactionData> result = facade.SaveTransactionItem(CurrentInstance.Id, TransactionItemDto);
             e.IsSuccessful = result.IsSuccessful;
             if (result.IsSuccessful)
             {
                 // Refresh
                 TransactionDto savedCurrentInstance = result.ToDto(new TransactionConverter());
                 CurrentInstance.TransactionItems = savedCurrentInstance.TransactionItems;
             }
             else
             {
                 // Deal with Update result
                 ProcUpdateResult(result.ValidationResult, result.Exception);
             }
             break;
         }
     }
 }
Esempio n. 4
0
 protected void childList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
 {
     if (e.InstanceType == ChildListType.SubjectFieldInfo.ToString())
     {
         SubjectFieldInfoDto currentField         = e.Instance as SubjectFieldInfoDto;
         IFacadeUpdateResult <SubjectData> result = SaveSubjectField(CurrentSubject.Id, currentField);
         e.IsSuccessful = result.IsSuccessful;
         if (result.IsSuccessful)
         {
             // Refresh data in session
             RetrieveSubjectFieldInfos();
         }
         else
         {
             ProcUpdateResult(result.ValidationResult, result.Exception);
         }
     }
     else if (e.InstanceType == ChildListType.SubjectChildList.ToString())
     {
         SubjectChildListDto childList            = e.Instance as SubjectChildListDto;
         IFacadeUpdateResult <SubjectData> result = SaveSubjectChildList(CurrentSubject.Id, childList);
         e.IsSuccessful = result.IsSuccessful;
         if (result.IsSuccessful)
         {
             // Refresh data in session
             RetrieveSubject();
         }
         else
         {
             ProcUpdateResult(result.ValidationResult, result.Exception);
         }
     }
 }
Esempio n. 5
0
        protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                ProductDto product = e.Instance as ProductDto;
                // Set defaulted value
                if (CurrentUserContext.IsSupplier)
                {
                    product.SupplierId = CurrentUserContext.User.MatchId;
                }
                ProductFacade facade = new ProductFacade(uow);
                IFacadeUpdateResult <ProductData> result = facade.SaveProduct(product);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    RetrieveInstances(facade);
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
Esempio n. 6
0
 protected void ucListManager_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
 {
     if (InstanceRowSaving != null)
     {
         InstanceRowSaving(this, e);
     }
 }
Esempio n. 7
0
        protected void ucListManager_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            DEntityDto instance = e.Instance as DEntityDto;
            IFacadeUpdateResult <DEntityData> result = SaveDEntity(instance);

            e.IsSuccessful = result.IsSuccessful;
        }
        private void SaveRow(BaseDto instance, OrderedDictionary fieldKeyValues)
        {
            foreach (string prop in fieldKeyValues.Keys)
            {
                ReflectionHelper.SetValue(instance, prop, fieldKeyValues[prop]);
            }

            InstanceRowSavingEventArgs arg = new InstanceRowSavingEventArgs(instance, InstanceType);

            if (InstanceRowSaving != null)
            {
                InstanceRowSaving(this, arg);
            }
        }
        protected void ucIDetail_ChildListInstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                DomainFacade facade = new DomainFacade(uow);

                switch ((InstanceTypes)Enum.Parse(typeof(InstanceTypes), e.InstanceType))
                {
                case InstanceTypes.DomainMainMenu:
                    DomainMainMenuDto itemDto = e.Instance as DomainMainMenuDto;
                    // Save data
                    IFacadeUpdateResult <DomainData> result1 = facade.SaveDomainMainMenu(CurrentInstance.Id, itemDto);
                    e.IsSuccessful = result1.IsSuccessful;
                    if (result1.IsSuccessful)
                    {
                        // Refresh
                        DomainDto savedParentInstance = result1.ToDto(new DomainConverter());
                        CurrentInstance.DomainMainMenus = savedParentInstance.DomainMainMenus;
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result1.ValidationResult, result1.Exception);
                    }
                    break;

                case InstanceTypes.DomainSetupMenu:
                    DomainSetupMenuDto itemDto2 = e.Instance as DomainSetupMenuDto;
                    // Save data
                    IFacadeUpdateResult <DomainData> result2 = facade.SaveDomainSetupMenu(CurrentInstance.Id, itemDto2);
                    e.IsSuccessful = result2.IsSuccessful;
                    if (result2.IsSuccessful)
                    {
                        // Refresh
                        DomainDto savedParentInstance = result2.ToDto(new DomainConverter());
                        CurrentInstance.DomainSetupMenus = savedParentInstance.DomainSetupMenus;
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result2.ValidationResult, result2.Exception);
                    }
                    break;
                }
            }
        }
Esempio n. 10
0
 protected void childList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
 {
     if (e.InstanceType == ChildListType.EntityItem.ToString())
     {
         DEntityItemDto item = e.Instance as DEntityItemDto;
         IFacadeUpdateResult <DEntityData> result = SaveDEntityItem(CurrentDEntity.Id, item);
         e.IsSuccessful = result.IsSuccessful;
         if (result.IsSuccessful)
         {
             // Refresh data in session
             RetrieveData();
         }
         else
         {
             ProcUpdateResult(result.ValidationResult, result.Exception);
         }
     }
 }
Esempio n. 11
0
        protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                DocumentDto    project = e.Instance as DocumentDto;
                DocumentFacade facade  = new DocumentFacade(uow);
                IFacadeUpdateResult <DocumentData> result = facade.SaveDocument(project);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    RetrieveInstances(facade);
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
Esempio n. 12
0
        protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                UserDto    instance = e.Instance as UserDto;
                UserFacade facade   = new UserFacade(uow);
                IFacadeUpdateResult <UserData> result = facade.SaveUser(instance);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    CurrentInstances = facade.RetrieveAllUser();
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
Esempio n. 13
0
        protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                CatalogDto    project = e.Instance as CatalogDto;
                CatalogFacade facade  = new CatalogFacade(uow);
                IFacadeUpdateResult <CatalogData> result = facade.SaveCatalog(project);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    CurrentInstances = facade.RetrieveAllCatalog(new CatalogConverter());
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
        protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                SetupMenuDto    project = e.Instance as SetupMenuDto;
                SetupMenuFacade facade  = new SetupMenuFacade(uow);
                IFacadeUpdateResult <SetupMenuData> result = facade.SaveSetupMenu(project);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    CurrentInstances = facade.RetrieveAllSetupMenu();
                    // Refresh global cache
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
        protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                ApplicationSettingDto    project = e.Instance as ApplicationSettingDto;
                ApplicationSettingFacade facade  = new ApplicationSettingFacade(uow);
                IFacadeUpdateResult <ApplicationSettingData> result = facade.SaveApplicationSetting(project);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    CurrentInstances = facade.RetrieveAllApplicationSetting();
                    // Refresh global cache
                    //WebContext.Current.ApplicationOption = facade.GetApplicationOption();
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
Esempio n. 16
0
 protected void ucIDetail_ChildListInstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
 {
 }
        protected void ucIDetail_ChildListInstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                switch ((InstanceTypes)Enum.Parse(typeof(InstanceTypes), e.InstanceType))
                {
                case InstanceTypes.Contact:
                    ContactFacade facade     = new ContactFacade(uow);
                    ContactDto    contactDto = e.Instance as ContactDto;
                    contactDto.CustomerId = CurrentInstance.Id;
                    // Save data
                    IFacadeUpdateResult <ContactData> result = facade.SaveContact(contactDto);
                    e.IsSuccessful = result.IsSuccessful;
                    if (result.IsSuccessful)
                    {
                        // Refresh data in session
                        CurrentInstance.Contacts = facade.RetrieveContactsByCustomer(CurrentInstance.Id, new ContactConverter());
                    }
                    else
                    {
                        ProcUpdateResult(result.ValidationResult, result.Exception);
                    }
                    break;

                case InstanceTypes.ScheduleEvent:
                    ScheduleEventFacade facade2  = new ScheduleEventFacade(uow);
                    ScheduleEventDto    eventDto = e.Instance as ScheduleEventDto;
                    eventDto.ObjectId     = CurrentInstance.Id;
                    eventDto.ObjectTypeId = (int)EventObjectTypes.Customer;
                    // Save data
                    IFacadeUpdateResult <ScheduleEventData> result2 = facade2.SaveScheduleEvent(eventDto);
                    e.IsSuccessful = result2.IsSuccessful;
                    if (result2.IsSuccessful)
                    {
                        // Refresh data in session
                        CurrentInstance.ScheduleEvents = facade2.RetrieveScheduleEventsByCustomer(CurrentInstance.Id, new ScheduleEventConverter());
                    }
                    else
                    {
                        ProcUpdateResult(result2.ValidationResult, result2.Exception);
                    }
                    break;

                case InstanceTypes.ShipTo:
                    ShipToFacade facade3   = new ShipToFacade(uow);
                    ShipToDto    shipToDto = e.Instance as ShipToDto;
                    shipToDto.CustomerId = CurrentInstance.Id;
                    // Save data
                    IFacadeUpdateResult <ShipToData> result3 = facade3.SaveShipTo(shipToDto);
                    e.IsSuccessful = result3.IsSuccessful;
                    if (result3.IsSuccessful)
                    {
                        // Refresh data in session
                        CurrentInstance.ShipTos = facade3.RetrieveShipTosByCustomer(CurrentInstance.Id, new ShipToConverter());
                    }
                    else
                    {
                        ProcUpdateResult(result3.ValidationResult, result3.Exception);
                    }
                    break;
                }
            }
        }
        protected void ucIDetail_ChildListInstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                switch ((InstanceTypes)Enum.Parse(typeof(InstanceTypes), e.InstanceType))
                {
                case InstanceTypes.ContactContactMethod:
                    ContactFacade           facade           = new ContactFacade(uow);
                    ContactContactMethodDto contactMethodDto = e.Instance as ContactContactMethodDto;
                    // Save data
                    IFacadeUpdateResult <ContactData> result = facade.SaveContactContactMethod(CurrentInstance.Id, contactMethodDto);
                    e.IsSuccessful = result.IsSuccessful;
                    if (result.IsSuccessful)
                    {
                        // Refresh
                        ContactDto savedCurrentInstance = result.ToDto(new ContactConverter());
                        CurrentInstance.ContactContactMethods = savedCurrentInstance.ContactContactMethods;
                        // Note: Can't refresh CurrentInstance this way, it will ruin other child list data
                        //ucIDetail.CurrentInstance = savedInstance;
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result.ValidationResult, result.Exception);
                    }
                    break;

                case InstanceTypes.ScheduleEvent:
                    ScheduleEventFacade facade2  = new ScheduleEventFacade(uow);
                    ScheduleEventDto    eventDto = e.Instance as ScheduleEventDto;
                    eventDto.ObjectId     = CurrentInstance.Id;
                    eventDto.ObjectTypeId = (int)EventObjectTypes.Contact;
                    // Save data
                    IFacadeUpdateResult <ScheduleEventData> result2 = facade2.SaveScheduleEvent(eventDto);
                    e.IsSuccessful = result2.IsSuccessful;
                    if (result2.IsSuccessful)
                    {
                        // Refresh data in session
                        CurrentInstance.ScheduleEvents = facade2.RetrieveScheduleEventsByContact(CurrentInstance.Id, new ScheduleEventConverter());
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result2.ValidationResult, result2.Exception);
                    }
                    break;

                case InstanceTypes.Activity:
                    ActivityFacade facade3     = new ActivityFacade(uow);
                    ActivityDto    activityDto = e.Instance as ActivityDto;
                    activityDto.ContactId  = CurrentInstance.Id;
                    activityDto.CustomerId = CurrentInstance.CustomerId;
                    activityDto.EmployeeId = CurrentUserContext.User.MatchId;
                    // Save data
                    IFacadeUpdateResult <ActivityData> result3 = facade3.SaveActivity(activityDto);
                    e.IsSuccessful = result3.IsSuccessful;
                    if (result3.IsSuccessful)
                    {
                        // Refresh data in session
                        CurrentInstance.Activitys = facade3.RetrieveActivitysByContact(CurrentInstance.Id, new ActivityConverter());
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result3.ValidationResult, result3.Exception);
                    }
                    break;

                case InstanceTypes.Transaction:
                    TransactionFacade facade4        = new TransactionFacade(uow);
                    TransactionDto    TransactionDto = e.Instance as TransactionDto;
                    TransactionDto.ContactId  = CurrentInstance.Id;
                    TransactionDto.CustomerId = CurrentInstance.CustomerId;
                    // Save data
                    IFacadeUpdateResult <TransactionData> result4 = facade4.SaveTransaction(TransactionDto);
                    e.IsSuccessful = result4.IsSuccessful;
                    if (result4.IsSuccessful)
                    {
                        // Refresh data in session
                        CurrentInstance.Transactions = facade4.RetrieveTransactionsByContact(CurrentInstance.Id, new TransactionConverter());
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result4.ValidationResult, result4.Exception);
                    }
                    break;
                }
            }
        }