Example #1
0
        public ActionResult Create(StaffFamilyViewModel model)
        {
            if (ModelState.IsValid)
            {
                var StaffFamily = new Domain.Staff.Entities.StaffFamily();
                AutoMapper.Mapper.Map(model, StaffFamily);
                StaffFamily.IsDeleted      = false;
                StaffFamily.CreatedUserId  = WebSecurity.CurrentUserId;
                StaffFamily.ModifiedUserId = WebSecurity.CurrentUserId;
                StaffFamily.CreatedDate    = DateTime.Now;
                StaffFamily.ModifiedDate   = DateTime.Now;
                StaffFamilyRepository.InsertStaffFamily(StaffFamily);

                if (Request["IsPopup"] == "true" || Request["IsPopup"] == "True")
                {
                    ViewBag.closePopup = "true";
                    model.Id           = StaffFamily.Id;
                    //model.GenderList = Helpers.SelectListHelper.GetSelectList_Gender(null);
                    //model.CorrelativeList = Helpers.SelectListHelper.GetSelectList_Category("Correlative", null, "Name", App_GlobalResources.Wording.Empty);
                    return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
                    //return View(model);
                }

                TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
                return(RedirectToAction("Detail", "Staffs", new { area = "Staff", Id = model.StaffId }));
            }
            return(View(model));
        }
Example #2
0
        public ActionResult Edit(StaffFamilyViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var StaffFamily = StaffFamilyRepository.GetStaffFamilyById(model.Id);
                    AutoMapper.Mapper.Map(model, StaffFamily);
                    StaffFamily.ModifiedUserId = WebSecurity.CurrentUserId;
                    StaffFamily.ModifiedDate   = DateTime.Now;
                    StaffFamilyRepository.UpdateStaffFamily(StaffFamily);
                    if (Request["IsPopup"] == "true" || Request["IsPopup"] == "True")
                    {
                        ViewBag.closePopup = "true";
                        model.Id           = StaffFamily.Id;
                        model.GenderList   = Helpers.SelectListHelper.GetSelectList_Gender(model.Gender != null && model.Gender.Value ? true : false);
                        //model.CorrelativeList = Helpers.SelectListHelper.GetSelectList_Category("Correlative", model.Correlative, "Name", App_GlobalResources.Wording.Empty);
                        return(View(model));
                    }
                    //TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess;
                    //return RedirectToAction("Detail", "Staffs", new { area = "Staff", Id = model.StaffId });
                }

                return(View(model));
            }

            return(View(model));

            //if (Request.UrlReferrer != null)
            //    return Redirect(Request.UrlReferrer.AbsoluteUri);
            //return RedirectToAction("Index");
        }
Example #3
0
        public ViewResult Create(int?StaffId)
        {
            var model = new StaffFamilyViewModel();

            model.StaffId = StaffId;
            //model.GenderList = Helpers.SelectListHelper.GetSelectList_Gender(null);
            //model.CorrelativeList = Helpers.SelectListHelper.GetSelectList_Category("Correlative", null, "Name",App_GlobalResources.Wording.Empty);
            return(View(model));
        }
Example #4
0
        public ActionResult CreateListFamily(StaffFamilyViewModel model)
        {
            if (ModelState.IsValid)
            {
                var StaffFamily = new Domain.Staff.Entities.StaffFamily();
                AutoMapper.Mapper.Map(model, StaffFamily);
                StaffFamily.IsDeleted      = false;
                StaffFamily.CreatedUserId  = WebSecurity.CurrentUserId;
                StaffFamily.ModifiedUserId = WebSecurity.CurrentUserId;
                StaffFamily.CreatedDate    = DateTime.Now;
                StaffFamily.ModifiedDate   = DateTime.Now;
                StaffFamilyRepository.InsertStaffFamily(StaffFamily);

                if (Request["IsPopup"] == "true" || Request["IsPopup"] == "True")
                {
                    ViewBag.closePopup = "true";
                    model.Id           = StaffFamily.Id;

                    return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
                }
            }
            return(View(model));
        }
Example #5
0
        public ActionResult Edit(int?Id)
        {
            var StaffFamily = StaffFamilyRepository.GetStaffFamilyById(Id.Value);

            if (StaffFamily != null && StaffFamily.IsDeleted != true)
            {
                var model = new StaffFamilyViewModel();
                AutoMapper.Mapper.Map(StaffFamily, model);
                model.GenderList = Helpers.SelectListHelper.GetSelectList_Gender(model.Gender != null && model.Gender.Value ? true : false);
                //model.CorrelativeList = Helpers.SelectListHelper.GetSelectList_Category("Correlative", model.Correlative, "Name", App_GlobalResources.Wording.Empty);
                //if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1)
                //{
                //    TempData["FailedMessage"] = "NotOwner";
                //    return RedirectToAction("Index");
                //}

                return(View(model));
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
            return(RedirectToAction("Index"));
        }
Example #6
0
        public ActionResult CreateListFamily()
        {
            var model = new StaffFamilyViewModel();

            return(View(model));
        }