Esempio n. 1
0
        public ActionResult Edit(int bankId)
        {
            ViewModelItem viewModelItem = new ViewModelItem();
            BankService   bankService   = new BankService();
            Bank          bank          = bankService.Set().Single(s => s.ID == bankId);

            viewModelItem.BankModel          = (BankModel)bank;
            viewModelItem.ContactPersonModel = (ContactPersonModel)bankService.Set().Single(s => s.ID == bankId).ContactPersons.Single(s => s.Position.Name == "General Director");

            return(View(viewModelItem));
        }
Esempio n. 2
0
        public ActionResult NewContactPerson(ViewModelItem viewModelItem, int bankId)
        {
            PositionService positionService = new PositionService();
            BankService     bankService     = new BankService();
            Bank            bank            = bankService.Set().Single(s => s.ID == bankId);
            ContactPerson   contactPerson   = (ContactPerson)viewModelItem.ContactPersonModel;

            contactPerson.PositionID = positionService.Set().Single(s => s.ID == viewModelItem.ContactPersonModel.Position.ID).ID;
            bank.ContactPersons.Add(contactPerson);
            bankService.Commit();

            return(RedirectToAction("NewContactPerson", new { bankId = bankService.Set().Last().ID }));
        }
Esempio n. 3
0
        public override void Create(CreateViewModelRequest <TextHolder> req)
        {
            if (req.Element == null)
            {
                //TODO: просто ничего не делаем, хотя надо бы это обрабатывать
                return;
            }

            ViewModelItem item = ViewModelItemFactory.Create(req.Element, req.Handler, Serializer);

            req.AppendModelAction(new ElementViewModel()
            {
                item
            });
        }
        private void AppendKanonasHeader(CreateViewModelRequest <KanonasRule> req, Kanonas kanonas)
        {
            int hash = kanonas.GetHashCode();

            ViewModelItem view = null;

            if (!kanonasHeaders.ContainsKey(hash))
            {
                TextHolder holder = null;
                string     name   = "";
                if (kanonas.Name != null)
                {
                    holder = GetHeaders(req)[2];
                    name   = kanonas.Name[req.Handler.Settings.Language.Name];
                }
                else
                {
                    holder = GetHeaders(req)[3];
                }

                var kanonasP = ParagraphVMFactory.Create(holder.Paragraphs[0], req.Handler.Settings.Language.Name);
                kanonasP.Replace("[kanonas]", name);
                kanonasP.Replace("[ihos]", req.Handler.Settings.Language.IntConverter.ToString(kanonas.Ihos));

                view = ViewModelItemFactory.Create(TextHolderKind.Text, new List <ParagraphViewModel>()
                {
                    kanonasP
                });


                //string kanonasString = holder.Paragraphs[0][req.Handler.Settings.Language.Name];
                //kanonasString = kanonasString.Replace("[kanonas]", name).
                //                              Replace("[ihos]", req.Handler.Settings.Language.IntConverter.ToString(kanonas.Ihos));
                //view = ViewModelItemFactory.Create(TextHolderKind.Text, new List<string> { kanonasString });

                kanonasHeaders.Add(hash, view);
            }
            else
            {
                view = kanonasHeaders[hash];
            }

            req.AppendModelAction(new ElementViewModel()
            {
                view
            });
        }
Esempio n. 5
0
        public ActionResult New(ViewModelItem viewModelItem)
        {
            PositionService positionService = new PositionService();

            viewModelItem.ContactPersonModel.PositionID = positionService.Set().First(s => s.Name.Equals("General Director")).ID;
            BankService   bankService   = new BankService();
            ContactPerson contactPerson = (ContactPerson)viewModelItem.ContactPersonModel;

            bankService.Save(new Bank()
            {
                Name           = viewModelItem.BankModel.Name,
                URL            = viewModelItem.BankModel.URL,
                ContactPersons = new List <ContactPerson>()
                {
                    contactPerson
                }
            });
            bankService.Commit();
            return(RedirectToAction("NewContactPerson", new { bankId = bankService.Set().Last().ID }));
        }
Esempio n. 6
0
        public ActionResult NewContactPerson(int bankId, int?contactPersonId)
        {
            if (contactPersonId != null)
            {
                ContactPersonService contactPersonService = new ContactPersonService();
                contactPersonService.Remove(contactPersonService.Set().Single(s => s.ID == contactPersonId));
                contactPersonService.Commit();

                return(RedirectToAction("NewContactPerson", new { bankId, contactPersonId = (int?)null }));
            }
            BankService     bankService     = new BankService();
            ViewModelItem   viewModelItem   = new ViewModelItem();
            PositionService positionService = new PositionService();

            viewModelItem.BankModel      = (BankModel)bankService.Set().Single(s => s.ID == bankId);
            viewModelItem.PositionModels = positionService.Set().Select(s => (PositionModel)s).ToList();
            var list = bankService.Set().Single(s => s.ID == bankId).ContactPersons;

            viewModelItem.ContactPersonModels = bankService.Set().Single(s => s.ID == bankId).ContactPersons.Where(w => w.Position.Name != "General Director").Select(a => (ContactPersonModel)a).ToList();

            return(View(viewModelItem));
        }
        private void AppendKatavasiaHeader(CreateViewModelRequest <KanonasRule> req, int ihos)
        {
            if (katavasiaHeader == null)
            {
                var katavasiaP = ParagraphVMFactory.Create(GetHeaders(req)[4].Paragraphs[0], req.Handler.Settings.Language.Name);
                katavasiaP.Replace("[ihos]", req.Handler.Settings.Language.IntConverter.ToString(ihos));

                katavasiaHeader = ViewModelItemFactory.Create(TextHolderKind.Text, new List <ParagraphViewModel>()
                {
                    katavasiaP
                });

                //string str = GetHeaders(req)[4].Paragraphs[0][req.Handler.Settings.Language.Name];
                //str = str.Replace("[ihos]", req.Handler.Settings.Language.IntConverter.ToString(ihos));

                //katavasiaHeader = ViewModelItemFactory.Create(TextHolderKind.Text, new List<string> { str });
            }

            req.AppendModelAction(new ElementViewModel()
            {
                katavasiaHeader
            });
        }
Esempio n. 8
0
        public ActionResult Edit(ViewModelItem viewModelItem, DateTime BirthDate)
        {
            BankService bankService = new BankService();
            Bank        bank        = bankService.Set().Single(s => s.ID == viewModelItem.BankModel.ID);

            bank.Name = viewModelItem.BankModel.Name;
            bank.URL  = viewModelItem.BankModel.URL;
            bankService.Commit();

            viewModelItem.ContactPersonModel.DateOfBirth = BirthDate;

            ContactPersonService contactPersonService = new ContactPersonService();
            ContactPerson        contactPerson        = contactPersonService.Set().Single(s => s.ID == viewModelItem.ContactPersonModel.ID);

            contactPerson.FirstName   = viewModelItem.ContactPersonModel.FirstName;
            contactPerson.LastName    = viewModelItem.ContactPersonModel.LastName;
            contactPerson.DateOfBirth = viewModelItem.ContactPersonModel.DateOfBirth;
            contactPersonService.Commit();

            viewModelItem.FromPost = true;

            return(View(viewModelItem));
        }
        private void AppendIkos(CreateViewModelRequest <KontakionRule> req, ItemText ikos, ViewModelItem view)
        {
            var viewModel = new ElementViewModel()
            {
                view
            };

            ikos.AppendViewModel(req.Handler, viewModel);

            req.AppendModelAction(viewModel);
        }
        private void AppendKontakion(CreateViewModelRequest <KontakionRule> req, YmnosStructure kontakion, ViewModelItem view)
        {
            var viewModel = new ElementViewModel()
            {
                view
            };

            var group = kontakion.Groups[0];

            group.Annotation.AppendViewModel(req.Handler, viewModel);
            group.Prosomoion.AppendViewModel(req.Handler, Serializer, viewModel);
            group.Ymnis[0].Text.AppendViewModel(req.Handler, viewModel);

            req.AppendModelAction(viewModel);
        }