Example #1
0
        // GET: /ProductMaster/Create

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

            vm.IsActive = true;
            return(View("Create", vm));
        }
Example #2
0
        // GET: /ProductMaster/Edit/5

        public ActionResult Edit(int id)
        {
            SalesTaxGroupProduct pt = _SalesTaxGroupProductService.Find(id);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            return(View("Create", pt));
        }
Example #3
0
        // GET: /ProductMaster/Delete/5

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

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

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

            return(PartialView("_Reason", vm));
        }
Example #4
0
 public SalesTaxGroupProduct Add(SalesTaxGroupProduct pt)
 {
     _unitOfWork.Repository <SalesTaxGroupProduct>().Insert(pt);
     return(pt);
 }
Example #5
0
 public void Update(SalesTaxGroupProduct pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <SalesTaxGroupProduct>().Update(pt);
 }
Example #6
0
 public void Delete(SalesTaxGroupProduct pt)
 {
     _unitOfWork.Repository <SalesTaxGroupProduct>().Delete(pt);
 }
Example #7
0
 public SalesTaxGroupProduct Create(SalesTaxGroupProduct pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <SalesTaxGroupProduct>().Insert(pt);
     return(pt);
 }
Example #8
0
        public ActionResult Post(SalesTaxGroupProduct vm)
        {
            SalesTaxGroupProduct pt = vm;


            if (ModelState.IsValid)
            {
                if (vm.SalesTaxGroupProductId <= 0)
                {
                    pt.CreatedDate  = DateTime.Now;
                    pt.ModifiedDate = DateTime.Now;
                    pt.CreatedBy    = User.Identity.Name;
                    pt.ModifiedBy   = User.Identity.Name;
                    pt.ObjectState  = Model.ObjectState.Added;
                    _SalesTaxGroupProductService.Create(pt);

                    try
                    {
                        _unitOfWork.Save();
                    }

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

                    LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId    = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.SalesTaxGroupProduct).DocumentTypeId,
                        DocId        = pt.SalesTaxGroupProductId,
                        ActivityType = (int)ActivityTypeContants.Added,
                    }));

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

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

                    SalesTaxGroupProduct temp = _SalesTaxGroupProductService.Find(pt.SalesTaxGroupProductId);

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

                    temp.SalesTaxGroupProductName = pt.SalesTaxGroupProductName;
                    temp.IsActive     = pt.IsActive;
                    temp.ModifiedDate = DateTime.Now;
                    temp.ModifiedBy   = User.Identity.Name;
                    temp.ObjectState  = Model.ObjectState.Modified;
                    _SalesTaxGroupProductService.Update(temp);

                    LogList.Add(new LogTypeViewModel
                    {
                        ExObj = ExRec,
                        Obj   = temp,
                    });
                    XElement Modifications = new ModificationsCheckService().CheckChanges(LogList);
                    try
                    {
                        _unitOfWork.Save();
                    }

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

                    LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId       = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.SalesTaxGroupProduct).DocumentTypeId,
                        DocId           = temp.SalesTaxGroupProductId,
                        ActivityType    = (int)ActivityTypeContants.Modified,
                        xEModifications = Modifications,
                    }));

                    return(RedirectToAction("Index").Success("Data saved successfully"));
                }
            }
            return(View("Create", vm));
        }
 public SalesTaxGroupProduct Add(SalesTaxGroupProduct pt)
 {
     _SalesTaxGroupProductRepository.Insert(pt);
     return(pt);
 }
 public void Update(SalesTaxGroupProduct pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _SalesTaxGroupProductRepository.Update(pt);
 }
 public void Delete(SalesTaxGroupProduct pt)
 {
     _SalesTaxGroupProductRepository.Delete(pt);
 }
 public SalesTaxGroupProduct Create(SalesTaxGroupProduct pt)
 {
     pt.ObjectState = ObjectState.Added;
     _SalesTaxGroupProductRepository.Insert(pt);
     return(pt);
 }