Esempio n. 1
0
        public ActionResult Edit(int id, ClientVo input)
        {
            bool foundTheMatch = false;

            if (this.ModelState.IsValid)
            {
                ClientVo item = clientManager.get(id);
                if (item.organizations != null)
                {
                    foreach (ClientOrganizationLookupVo orgLookupVo in item.clientOrganizationLookupses)
                    {
                        foundTheMatch = false;
                        foreach (int clientRoleId in input.organizations)
                        {
                            if (orgLookupVo.organizationId == clientRoleId)
                            {
                                input.organizations.Remove(clientRoleId);
                                foundTheMatch = true;
                                break;
                            }
                        }
                        if (!foundTheMatch)
                        {
                            clientOrganizationLookupManager.delete(orgLookupVo.clientOrganizationLookupId);
                        }
                    }
                }
                if (input.organizations != null)
                {
                    foreach (int orgId in input.organizations)
                    {
                        var clientOrganizationLookupVo = new ClientOrganizationLookupVo();
                        clientOrganizationLookupVo.clientId       = input.clientId;
                        clientOrganizationLookupVo.organizationId = orgId;
                        clientOrganizationLookupVo.isActive       = true;
                        clientOrganizationLookupManager.insert(clientOrganizationLookupVo);
/*=================This sections adds clientfee amount to the organization total fee amount=========================================*/
                        if (input.feeAmount != null)
                        {
                            OrganizationVo currentOrg = organizationManager.get(orgId);
                            if (currentOrg != null)
                            {
                                OrganizationManager.updateOrganizationFeeAmountForClientController(currentOrg, input.feeAmount);
                            }
                        }
                    }
                }

                contactInfoManager.update(input.contactInfo, input.contactInfoId);

                var res = clientManager.update(input, id);
                return(RedirectToAction("Index"));
            }

            return(View(input));
        }
        public ActionResult Edit(int id, ContactInfoVo input)
        {
            if (this.ModelState.IsValid)
            {
                var res = contactInfoManager.update(input, id);
                return(RedirectToAction("Index"));
            }

            return(View(input));
        }
        public ActionResult Edit(int id, OrganizationVo input)
        {
            if (this.ModelState.IsValid)
            {
                contactInfoManager.update(input.contactInfo, input.contactInfoId);
                var res = organizationManager.update(input, id);
                return(RedirectToAction("Index"));
            }

            return(View(input));
        }
Esempio n. 4
0
        public ActionResult Edit(MemberVo input)
        {
            var      id            = CurrentMember.member.memberId;
            bool     foundTheMatch = false;
            MemberVo item          = memberManager.get(id);

            if (this.ModelState.IsValid)
            {
                if (item.memberRoleTypes != null)
                {
                    foreach (MemberRoleLookupVo roleLookupVo in item.memberRoleLookupses)
                    {
                        foundTheMatch = false;
                        foreach (int memberRoleId in input.memberRoleTypes)
                        {
                            if (roleLookupVo.memberRoleTypeId == memberRoleId)
                            {
                                input.memberRoleTypes.Remove(memberRoleId);
                                foundTheMatch = true;
                                break;
                            }
                        }
                        if (!foundTheMatch)
                        {
                            memberRoleLookupManager.delete(roleLookupVo.memberRoleId);
                        }
                    }
                }
                if (input.memberRoleTypes != null)
                {
                    foreach (int roleId in input.memberRoleTypes)
                    {
                        var memberRoleLookupVo = new MemberRoleLookupVo();
                        memberRoleLookupVo.memberId         = input.memberId;
                        memberRoleLookupVo.memberRoleTypeId = roleId;
                        memberRoleLookupVo.isActive         = true;

                        memberRoleLookupManager.insert(memberRoleLookupVo);
                    }
                }
                contactInfoManager.update(input.contactInfo, input.contactInfo.contactInfoId);
                var res = memberManager.update(input, id);
                return(RedirectToAction("Index"));
            }

            return(View(input));
        }
Esempio n. 5
0
        public ActionResult Edit(int id, CompanyVo input)
        {
            bool      foundTheMatch = false;
            CompanyVo item          = companyManager.get(id);

            if (this.ModelState.IsValid)
            {
                if (item.companyCategories != null)
                {
                    foreach (CompanyCategoryLookupVo categoryLookupVo in item.companyCategoryLookupses)
                    {
                        foundTheMatch = false;
                        foreach (int categoryTypeId in input.companyCategories)
                        {
                            if (categoryLookupVo.companyCategoryTypeId == categoryTypeId)
                            {
                                input.companyCategories.Remove(categoryTypeId);
                                foundTheMatch = true;
                                break;
                            }
                        }
                        if (!foundTheMatch)
                        {
                            companyCategoryLookupManager.delete(categoryLookupVo.companyCategoryId);
                        }
                    }
                }
                if (input.companyCategories != null)
                {
                    foreach (int categoryId in input.companyCategories)
                    {
                        var companyCategoryLookupVo = new CompanyCategoryLookupVo();
                        companyCategoryLookupVo.companyId             = input.companyId;
                        companyCategoryLookupVo.companyCategoryTypeId = categoryId;
                        companyCategoryLookupVo.isActive = true;

                        companyCategoryLookupManager.insert(companyCategoryLookupVo);
                    }
                }
                contactInfoManager.update(input.contactInfo, input.contactInfo.contactInfoId);
                var res = companyManager.update(input, id);
                return(RedirectToAction("Index"));
            }
            return(View(input));
        }