コード例 #1
0
        public ActionResult _Create(int Id) //Id ==>Sale Order Header Id
        {
            PersonBankAccount s = new PersonBankAccount();

            s.PersonId = Id;
            PrepareViewBag(null);
            return(PartialView("_Create", s));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            PersonBankAccount PersonBankAccount = _PersonBankAccountService.Find(id);

            _PersonBankAccountService.Delete(id);


            _unitOfWork.Save();

            return(RedirectToAction("Index", new { Id = PersonBankAccount.PersonId }).Success("Data deleted successfully"));
        }
コード例 #3
0
        public ActionResult _Edit(int id)
        {
            PersonBankAccount temp = _PersonBankAccountService.GetPersonBankAccount(id);

            PrepareViewBag(temp);

            if (temp == null)
            {
                return(HttpNotFound());
            }
            return(PartialView("_Create", temp));
        }
コード例 #4
0
        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PersonBankAccount PersonBankAccount = _PersonBankAccountService.Find(id);

            if (PersonBankAccount == null)
            {
                return(HttpNotFound());
            }
            return(View(PersonBankAccount));
        }
コード例 #5
0
        public ActionResult DeletePost(PersonBankAccount vm)
        {
            _PersonBankAccountService.Delete(vm.PersonBankAccountID);

            try
            {
                _unitOfWork.Save();
            }

            catch (Exception ex)
            {
                string message = _exception.HandleException(ex);
                ModelState.AddModelError("", message);
                return(PartialView("EditSize", vm));
            }
            return(Json(new { success = true }));
        }
コード例 #6
0
        public ActionResult _CreatePost(PersonBankAccount svm)
        {
            if (ModelState.IsValid)
            {
                if (svm.PersonBankAccountID == 0)
                {
                    svm.CreatedDate  = DateTime.Now;
                    svm.ModifiedDate = DateTime.Now;
                    svm.CreatedBy    = User.Identity.Name;
                    svm.ModifiedBy   = User.Identity.Name;
                    svm.ObjectState  = Model.ObjectState.Added;
                    _PersonBankAccountService.Create(svm);


                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(PartialView("_Create", svm));
                    }
                    return(RedirectToAction("_Create", new { id = svm.PersonId }));
                }
                else
                {
                    svm.ModifiedBy   = User.Identity.Name;
                    svm.ModifiedDate = DateTime.Now;
                    _PersonBankAccountService.Update(svm);


                    //Saving the Activity Log
                    ActivityLog al = new ActivityLog()
                    {
                        ActivityType = (int)ActivityTypeContants.Modified,
                        DocId        = svm.PersonBankAccountID,
                        CreatedDate  = DateTime.Now,
                        //Narration = logstring.ToString(),
                        CreatedBy = User.Identity.Name,
                        //DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(TransactionDocCategoryConstants.PersonBankAccount).DocumentTypeId,
                    };
                    new ActivityLogService(_unitOfWork).Create(al);
                    //End of Saving the Activity Log


                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(PartialView("_Create", svm));
                    }


                    return(Json(new { success = true }));
                }
            }

            PrepareViewBag(svm);
            return(PartialView("_Create", svm));
        }
コード例 #7
0
 private void PrepareViewBag(PersonBankAccount s)
 {
 }
コード例 #8
0
 public PersonBankAccount Add(PersonBankAccount pt)
 {
     _unitOfWork.Repository <PersonBankAccount>().Insert(pt);
     return(pt);
 }
コード例 #9
0
 public void Update(PersonBankAccount pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <PersonBankAccount>().Update(pt);
 }
コード例 #10
0
 public void Delete(PersonBankAccount pt)
 {
     _unitOfWork.Repository <PersonBankAccount>().Delete(pt);
 }
コード例 #11
0
 public PersonBankAccount Create(PersonBankAccount pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <PersonBankAccount>().Insert(pt);
     return(pt);
 }