示例#1
0
        // GET: /ProductMaster/Edit/5

        public ActionResult Edit(int id)
        {
            ChargeGroupSettings pt = _ChargeGroupSettingsService.Find(id);

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

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

            if (ChargeGroupSettings == null)
            {
                return(HttpNotFound());
            }
            ReasonViewModel vm = new ReasonViewModel()
            {
                id = id,
            };

            return(PartialView("_Reason", vm));
        }
示例#3
0
        public ActionResult Post(ChargeGroupSettings vm)
        {
            ChargeGroupSettings pt = vm;

            if (ModelState.IsValid)
            {
                if (vm.ChargeGroupSettingsId <= 0)
                {
                    pt.CreatedDate  = DateTime.Now;
                    pt.ModifiedDate = DateTime.Now;
                    pt.CreatedBy    = User.Identity.Name;
                    pt.ModifiedBy   = User.Identity.Name;
                    pt.ObjectState  = Model.ObjectState.Added;
                    _ChargeGroupSettingsService.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.ChargeGroupSettings).DocumentTypeId,
                        DocId        = pt.ChargeGroupSettingsId,
                        ActivityType = (int)ActivityTypeContants.Added,
                    }));

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

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

                    ChargeGroupSettings temp = _ChargeGroupSettingsService.Find(pt.ChargeGroupSettingsId);

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

                    temp.ChargeTypeId          = pt.ChargeTypeId;
                    temp.ChargeGroupPersonId   = pt.ChargeGroupPersonId;
                    temp.ChargeGroupProductId  = pt.ChargeGroupProductId;
                    temp.ChargePer             = pt.ChargePer;
                    temp.ChargeLedgerAccountId = pt.ChargeLedgerAccountId;
                    temp.ProcessId             = pt.ProcessId;

                    temp.ModifiedDate = DateTime.Now;
                    temp.ModifiedBy   = User.Identity.Name;
                    temp.ObjectState  = Model.ObjectState.Modified;
                    _ChargeGroupSettingsService.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.ChargeGroupSettings).DocumentTypeId,
                        DocId           = temp.ChargeGroupSettingsId,
                        ActivityType    = (int)ActivityTypeContants.Modified,
                        xEModifications = Modifications,
                    }));

                    return(RedirectToAction("Index").Success("Data saved successfully"));
                }
            }
            return(View("Create", vm));
        }
示例#4
0
        // GET: /ChargeGroupSettingsMaster/Create

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

            return(View("Create", vm));
        }
示例#5
0
 public void Update(ChargeGroupSettings pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <ChargeGroupSettings>().Update(pt);
 }
示例#6
0
 public void Delete(ChargeGroupSettings pt)
 {
     _unitOfWork.Repository <ChargeGroupSettings>().Delete(pt);
 }
示例#7
0
 public ChargeGroupSettings Create(ChargeGroupSettings pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <ChargeGroupSettings>().Insert(pt);
     return(pt);
 }
示例#8
0
 public ChargeGroupSettings Add(ChargeGroupSettings pt)
 {
     _unitOfWork.Repository <ChargeGroupSettings>().Insert(pt);
     return(pt);
 }