// GET: /ProductMaster/Create

        public ActionResult Create()
        {
            PersonRateGroup vm = new PersonRateGroup();

            vm.IsActive = true;
            return(View("Create", vm));
        }
Ejemplo n.º 2
0
        // GET: /JobReceiveHeader/Create

        public ActionResult Create()//DocumentTypeId
        {
            PersonRateGroup vm = new PersonRateGroup();

            vm.DocTypeId = Constants.DocumentTypeIdConstants.PersonRateGroup;
            vm.SiteId    = (int)System.Web.HttpContext.Current.Session["SiteId"];
            vm.IsActive  = true;
            ViewBag.Mode = "Add";
            return(View("Create", vm));
        }
        // GET: /ProductMaster/Edit/5

        public ActionResult Edit(int id)
        {
            PersonRateGroup pt = _PersonRateGroupService.Find(id);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            return(View("Create", pt));
        }
Ejemplo n.º 4
0
        // GET: /JobReceiveHeader/Edit/5
        private ActionResult Edit(int id, string IndexType)
        {
            PersonRateGroup pt = _PersonRateGroupService.Find(id);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Mode = "Edit";
            return(View("Create", pt));
        }
Ejemplo n.º 5
0
        public ActionResult DeleteConfirmed(ReasonViewModel vm)
        {
            if (ModelState.IsValid)
            {
                //Commit the DB
                try
                {
                    List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

                    PersonRateGroup temp      = _PersonRateGroupService.Find(vm.id);
                    int             DocTypeId = (int)temp.DocTypeId;

                    LogList.Add(new LogTypeViewModel
                    {
                        ExObj = Mapper.Map <PersonRateGroup>(temp),
                    });

                    XElement Modifications = _modificationCheck.CheckChanges(LogList);

                    _PersonRateGroupService.Delete(vm.id);

                    _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId       = DocTypeId,
                        DocId           = temp.PersonRateGroupId,
                        ActivityType    = (int)ActivityTypeContants.Deleted,
                        UserRemark      = vm.Reason,
                        DocNo           = temp.PersonRateGroupName,
                        xEModifications = Modifications,
                        DocDate         = temp.CreatedDate,
                    }));
                }


                catch (Exception ex)
                {
                    string message = _exception.HandleException(ex);
                    TempData["CSEXC"] += message;
                    return(PartialView("_Reason", vm));
                }



                return(Json(new { success = true }));
            }
            return(PartialView("_Reason", vm));
        }
        // GET: /ProductMaster/Delete/5

        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PersonRateGroup PersonRateGroup = _PersonRateGroupService.Find(id);

            if (PersonRateGroup == null)
            {
                return(HttpNotFound());
            }

            ReasonViewModel vm = new ReasonViewModel()
            {
                id = id,
            };

            return(PartialView("_Reason", vm));
        }
Ejemplo n.º 7
0
        public ActionResult Post(PersonRateGroup vm)
        {
            int SiteId     = (int)System.Web.HttpContext.Current.Session["SiteId"];
            int DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"];

            PersonRateGroup pt = vm;

            if (ModelState.IsValid)
            {
                if (vm.PersonRateGroupId <= 0)
                {
                    pt.SiteId       = SiteId;
                    pt.DivisionId   = DivisionId;
                    pt.IsActive     = true;
                    pt.CreatedDate  = DateTime.Now;
                    pt.ModifiedDate = DateTime.Now;
                    pt.CreatedBy    = User.Identity.Name;
                    pt.ModifiedBy   = User.Identity.Name;
                    pt.ObjectState  = Model.ObjectState.Added;


                    try
                    {
                        _PersonRateGroupService.Create(pt);
                    }



                    catch (Exception ex)
                    {
                        ViewBag.Mode = "Add";
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(View("Create", vm));
                    }


                    _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId    = Constants.DocumentTypeIdConstants.PersonRateGroup,
                        DocId        = pt.PersonRateGroupId,
                        ActivityType = (int)ActivityTypeContants.Added,
                    }));


                    return(RedirectToAction("Create").Success("Data saved successfully"));
                }

                else
                {
                    List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

                    PersonRateGroup temp = _PersonRateGroupService.Find(pt.PersonRateGroupId);

                    PersonRateGroup ExRec = Mapper.Map <PersonRateGroup>(temp);

                    temp.PersonRateGroupName = pt.PersonRateGroupName;
                    temp.IsActive            = pt.IsActive;
                    temp.ModifiedDate        = DateTime.Now;
                    temp.ModifiedBy          = User.Identity.Name;
                    temp.ObjectState         = Model.ObjectState.Modified;


                    LogList.Add(new LogTypeViewModel
                    {
                        ExObj = ExRec,
                        Obj   = temp,
                    });

                    XElement Modifications = _modificationCheck.CheckChanges(LogList);

                    try
                    {
                        _PersonRateGroupService.Update(temp);
                    }

                    catch (Exception ex)
                    {
                        ViewBag.Mode = "Edit";
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(View("Create", pt));
                    }

                    _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId       = Constants.DocumentTypeIdConstants.PersonRateGroup,
                        DocId           = temp.PersonRateGroupId,
                        ActivityType    = (int)ActivityTypeContants.Modified,
                        xEModifications = Modifications,
                    }));

                    return(RedirectToAction("Index").Success("Data saved successfully"));
                }
            }
            return(View("Create", vm));
        }
Ejemplo n.º 8
0
        public ActionResult Delete(int id)
        {
            PersonRateGroup header = _PersonRateGroupService.Find(id);

            return(Remove(id));
        }
Ejemplo n.º 9
0
 public PersonRateGroup Create(PersonRateGroup pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <PersonRateGroup>().Add(pt);
     return(pt);
 }
Ejemplo n.º 10
0
 public PersonRateGroup Add(PersonRateGroup pt)
 {
     _unitOfWork.Repository <PersonRateGroup>().Insert(pt);
     return(pt);
 }
Ejemplo n.º 11
0
 public void Update(PersonRateGroup pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <PersonRateGroup>().Update(pt);
 }
Ejemplo n.º 12
0
 public void Delete(PersonRateGroup pt)
 {
     _unitOfWork.Repository <PersonRateGroup>().Delete(pt);
 }