Example #1
0
        public ActionResult Add(LegalEntityLegalRepresentativeView legalEntityLegalRepresentativeView, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                ILegalEntityLegalRepresentativesRepository legalEntityLegalRepresentativesRepository = new LegalEntityLegalRepresentativesRepository(db);
                LegalEntityLegalRepresentative             legalEntityLegalRepresentative            = new LegalEntityLegalRepresentative();

                legalEntityLegalRepresentativeView.ConvertTo(legalEntityLegalRepresentativeView, legalEntityLegalRepresentative);

                legalEntityLegalRepresentativesRepository.Add(legalEntityLegalRepresentative);
                legalEntityLegalRepresentativesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("INSERT", legalEntityLegalRepresentative.LegalEntityLegalRepresentativePK);

                if (TempData["legalEntityFK"] != null)
                {
                    return(RedirectToAction("Index", "LegalEntity"));
                }
                else
                {
                    return(RedirectToAction("Index", "LegalEntityLegalRepresentative"));
                }
            }
            else
            {
                legalEntityLegalRepresentativeView.BindDDLs(legalEntityLegalRepresentativeView, db);

                return(View(legalEntityLegalRepresentativeView));
            }
        }
Example #2
0
        public void ConvertFrom(LegalEntityLegalRepresentative legalEntityLegalRepresentative, LegalEntityLegalRepresentativeView legalEntityLegalRepresentativeView, ObjectContext db)
        {
            legalEntityLegalRepresentativeView.LegalEntityLegalRepresentativePK = legalEntityLegalRepresentative.LegalEntityLegalRepresentativePK;

            legalEntityLegalRepresentativeView.LegalEntityFK         = legalEntityLegalRepresentative.LegalEntityFK;
            legalEntityLegalRepresentativeView.WayOfRepresentationFK = legalEntityLegalRepresentative.WayOfRepresentationFK;
            legalEntityLegalRepresentativeView.LegalRepresentativeFK = legalEntityLegalRepresentative.LegalRepresentativeFK;

            legalEntityLegalRepresentativeView.Deleted = legalEntityLegalRepresentative.Deleted;

            ILegalEntitiesRepository legalEntitiesRepository = new LegalEntitiesRepository(db);
            LegalEntity legalEntity = legalEntitiesRepository.GetLegalEntityByPK((int)legalEntityLegalRepresentative.LegalEntityFK);

            legalEntityLegalRepresentativeView.LegalEntityName = legalEntity.Name + " (" + legalEntity.OIB + ")";
        }
Example #3
0
        public ActionResult Delete(int?legalEntityLegalRepresentativePK)
        {
            ILegalEntityLegalRepresentativesRepository legalEntityLegalRepresentativesRepository = new LegalEntityLegalRepresentativesRepository(db);

            if (legalEntityLegalRepresentativePK != null)
            {
                LegalEntityLegalRepresentative legalEntityLegalRepresentative = legalEntityLegalRepresentativesRepository.GetLegalEntityLegalRepresentativeByPK((int)legalEntityLegalRepresentativePK);

                legalEntityLegalRepresentative.Deleted = true;

                legalEntityLegalRepresentativesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", legalEntityLegalRepresentative.LegalEntityLegalRepresentativePK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
Example #4
0
        public ActionResult Edit(int?legalEntityLegalRepresentativePK)
        {
            if (legalEntityLegalRepresentativePK != null)
            {
                ILegalEntityLegalRepresentativesRepository legalEntityLegalRepresentativesRepository = new LegalEntityLegalRepresentativesRepository(db);
                LegalEntityLegalRepresentative             legalEntityLegalRepresentative            = legalEntityLegalRepresentativesRepository.GetLegalEntityLegalRepresentativeByPK((int)legalEntityLegalRepresentativePK);
                LegalEntityLegalRepresentativeView         legalEntityLegalRepresentativeView        = new LegalEntityLegalRepresentativeView();

                legalEntityLegalRepresentativeView.ConvertFrom(legalEntityLegalRepresentative, legalEntityLegalRepresentativeView, db);
                legalEntityLegalRepresentativeView.BindDDLs(legalEntityLegalRepresentativeView, db);

                return(View(legalEntityLegalRepresentativeView));
            }
            else
            {
                return(RedirectToAction("Index", "LegalEntityLegalRepresentative"));
            }
        }
Example #5
0
        public ActionResult Edit(LegalEntityLegalRepresentativeView legalEntityLegalRepresentativeView, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                ILegalEntityLegalRepresentativesRepository legalEntityLegalRepresentativesRepository = new LegalEntityLegalRepresentativesRepository(db);
                LegalEntityLegalRepresentative             legalEntityLegalRepresentative            = legalEntityLegalRepresentativesRepository.GetLegalEntityLegalRepresentativeByPK((int)legalEntityLegalRepresentativeView.LegalEntityLegalRepresentativePK);
                legalEntityLegalRepresentativeView.ConvertTo(legalEntityLegalRepresentativeView, legalEntityLegalRepresentative);

                legalEntityLegalRepresentativesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", legalEntityLegalRepresentative.LegalEntityLegalRepresentativePK);

                return(RedirectToAction("Index", "LegalEntityLegalRepresentative"));
            }
            else
            {
                legalEntityLegalRepresentativeView.BindDDLs(legalEntityLegalRepresentativeView, db);

                return(View(legalEntityLegalRepresentativeView));
            }
        }
Example #6
0
        public void ConvertTo(LegalEntityLegalRepresentativeView legalEntityLegalRepresentativeView, LegalEntityLegalRepresentative legalEntityLegalRepresentative)
        {
            legalEntityLegalRepresentative.LegalEntityFK         = legalEntityLegalRepresentativeView.LegalEntityFK;
            legalEntityLegalRepresentative.WayOfRepresentationFK = legalEntityLegalRepresentativeView.WayOfRepresentationFK;
            legalEntityLegalRepresentative.LegalRepresentativeFK = legalEntityLegalRepresentativeView.LegalRepresentativeFK;

            legalEntityLegalRepresentative.ChangeDate = legalEntityLegalRepresentativeView.ChangeDate;

            legalEntityLegalRepresentative.Deleted = legalEntityLegalRepresentativeView.Deleted;
        }