Пример #1
0
        public static Funq.Container Build(Funq.Container container)
        {
            container.Register <HostContext>(c => HostContext.Instance).ReusedWithin(Funq.ReuseScope.Request);

            container.RegisterAutoWiredAs <CommonFormatterUtil, ICommonFormatterUtil>();
            container.RegisterAutoWiredAs <ContactRepositoryFactory, IContactRepositoryFactory>();
            container.RegisterAutoWiredAs <Helpers, IHelpers>();
            container.RegisterAutoWiredAs <ContactDataManager, IContactDataManager>();
            container.RegisterAutoWiredAs <ContactTypeLookUpRepositoryFactory, IContactTypeLookUpRepositoryFactory>();
            container.RegisterAutoWiredAs <ContactTypeLookUpManager, IContactTypeLookUpManager>();

            //Register CareTeam
            container.RegisterAutoWiredAs <MongoCareTeamRepository, ICareTeamRepository>();
            container.RegisterAutoWiredAs <CareTeamRepositoryFactory, ICareTeamRepositoryFactory>();
            container.RegisterAutoWiredAs <CareTeamDataManager, ICareTeamManager>();

            container.RegisterAutoWiredAs <CommonDataManager, ICommonDataManager>();


            container.RegisterAutoWiredAs <AuditHelpers, IAuditHelpers>();

            container = ContactContainer.Configure(container);

            return(container);
        }
Пример #2
0
        private async Task <ContactContainer> StoreContactPicture(ContactContainer img, Contact contact, IFormFile picture)
        {
            if (picture != null)
            {
                using (var stream = new System.IO.MemoryStream())
                {
                    await picture.CopyToAsync(stream);

                    img.Image     = stream.ToArray();
                    img.ContactId = contact.Id;
                }
            }

            return(img);
        }
Пример #3
0
        public IActionResult ContactContainerContent()
        {
            var comp    = _context.Companies.Where(x => x.CreatorId == User.Identity.GetUserId()).FirstOrDefault();
            var contact = _context.ContactPages.Where(x => x.CompanyId == comp.Id).FirstOrDefault();
            List <ContactContainer> containers = new List <ContactContainer>();

            for (int i = 0; i < contact.ContainerAmount; i++)
            {
                ContactContainer newCont = new ContactContainer()
                {
                    ContactId  = contact.Id,
                    DivSection = i + 1
                };
                containers.Add(newCont);
            }
            return(View(containers));
        }
Пример #4
0
        public async Task <IActionResult> ContactContainerContent(IFormCollection form, IFormFile pic1, IFormFile pic2, IFormFile pic3)
        {
            var company = _context.Companies.Where(x => x.CreatorId == User.Identity.GetUserId()).FirstOrDefault();
            var contact = _context.ContactPages.Where(x => x.CompanyId == company.Id).FirstOrDefault();

            if (pic1 != null || pic2 != null || pic3 != null)
            {
                if (pic1 != null)
                {
                    ContactContainer newImage = new ContactContainer();
                    newImage = await StoreContactPicture(newImage, contact, pic1);

                    newImage.DivSection = 1;
                    newImage.ContactId  = contact.Id;
                    _context.ContactContainers.Add(newImage);
                }
                if (pic2 != null)
                {
                    ContactContainer newImage = new ContactContainer();
                    newImage = await StoreContactPicture(newImage, contact, pic2);

                    newImage.DivSection = 2;
                    newImage.ContactId  = contact.Id;
                    _context.ContactContainers.Add(newImage);
                }
                if (pic3 != null)
                {
                    ContactContainer newImage = new ContactContainer();
                    newImage = await StoreContactPicture(newImage, contact, pic3);

                    newImage.DivSection = 3;
                    newImage.ContactId  = contact.Id;
                    _context.ContactContainers.Add(newImage);
                }
            }
            for (int i = 0; i < contact.ContainerAmount; i++)
            {
                string container = (i + 1).ToString();
                string check     = "textArea+" + container;
                if (form[check] != "")
                {
                    string           align   = "Alignment+" + container;
                    string           color   = "Color+" + container;
                    string           font    = "Font+" + container;
                    string           size    = "Size+" + container;
                    string           BgColor = "BackgroundColor+" + container;
                    ContactContainer newText = new ContactContainer();
                    newText.Text       = form[check];
                    newText.Align      = form[align];
                    newText.Color      = form[color];
                    newText.Font       = form[font];
                    newText.BgColor    = form[BgColor];
                    newText.FontSize   = form[size];
                    newText.DivSection = (i + 1);
                    newText.ContactId  = contact.Id;
                    _context.ContactContainers.Add(newText);
                }
            }
            company.ContactSetupComplete = true;
            company.SetupComplete        = true;
            _context.SaveChanges();
            return(RedirectToAction("HomePage", "CompanyHome", new { id = company.Id }));
        }