public void TestMethod1() { CmnProcessLevel pl = new CmnProcessLevel(); pl.Name = "Recommend"; pl.Status = true; ProcessLevelController plc = new ProcessLevelController(); var result= plc.Save(pl); Assert.IsInstanceOfType(result, typeof(ActionResult)); }
public void Test_Service_Save() { CmnProcessLevel pl = new CmnProcessLevel(); pl.Name = "Test2"; pl.Status = true; var result = _CmnProcessLevelService.Save(pl); Assert.IsInstanceOfType(result, typeof(Operation)); Assert.AreEqual(true, result.Success); Assert.AreEqual(true,result.Success,"A NullValueNotAllowedException was expected, but was not thrown."); }
public Operation Delete(CmnProcessLevel objCmnProcessLevel) { Operation objOperation = new Operation { Success = true, OperationId = objCmnProcessLevel.Id }; _CmnProcessLevelRepository.Delete(objCmnProcessLevel); try { _UnitOfWork.Commit(); } catch (Exception) { objOperation.Success = false; } return objOperation; }
public Operation Save(CmnProcessLevel objCmnProcessLevel) { Operation objOperation = new Operation { Success = true }; int Id = _CmnProcessLevelRepository.AddEntity(objCmnProcessLevel); objOperation.OperationId = Id; try { _UnitOfWork.Commit(); } catch (Exception ex) { objOperation.Success = false; } return objOperation; }
public ActionResult Save(CmnProcessLevel objCmnProcessLevel) { Operation objOperation = new Operation { Success = false }; if (ModelState.IsValid) { if (objCmnProcessLevel.Id == 0) { if ((bool)Session["Add"]) { objOperation = _CmnProcessLevelService.Save(objCmnProcessLevel); } else { objOperation.OperationId = -1; } } else { if ((bool)Session["Edit"]) { objOperation = _CmnProcessLevelService.Update(objCmnProcessLevel); } else { objOperation.OperationId = -2; } } } return Json(objOperation, JsonRequestBehavior.DenyGet); }
public ActionResult BindVoucherList(VoucherSearchViewModel obj, int companyId, int financialYear) { int processId = 0; int levelId = 0; string urlData = Request.UrlReferrer.Query; string[] array = urlData.Split('='); if (array.Length > 0) { processId = Convert.ToInt32(array[1]); levelId = Convert.ToInt32(array[2]); } //var list = ""; try { DataTable dt = _cmnApprovalProcessLevelService.GetByCompanyModuleApprovalProcessId(companyId, processId); var records = dt.DataTableToList<CmnApprovalProcessLevelMappingViewModel>(); Collection<CmnProcessLevel> collection = new Collection<CmnProcessLevel>(); foreach (CmnApprovalProcessLevelMappingViewModel objModel in records) { CmnProcessLevel objLevel = new CmnProcessLevel(); objLevel.Id = objModel.ProcessLevelId; objLevel.Name = objModel.Name; collection.Add(objLevel); } Collection<AnFVoucher> list = _IAnFVoucherService.GetForApproval(companyId, financialYear, processId, levelId, obj.DateFrom, obj.ToDate, obj.BusinessId, obj.ProjectId, collection); Collection<VoucherSearchResultViewModel> collections = new Collection<VoucherSearchResultViewModel>(); if (list != null) { foreach (AnFVoucher objVoucher in list) { VoucherSearchResultViewModel objValue = new VoucherSearchResultViewModel(); objValue.id = objVoucher.Id; objValue.VoucherNumber = objVoucher.VoucherNumber; objValue.DateString = objVoucher.Date.ToString(); collections.Add(objValue); } } return Json(collections, JsonRequestBehavior.AllowGet); } catch (Exception ex) { throw; } //Get the vouchers that are waiting for levels(check/pass/arrove) }