/// <summary> /// Get the service line code details. /// </summary> /// <param name="contractServiceLine">The contract service line list.</param> public ContractServiceLine GetServiceLineCodeDetails(ContractServiceLine contractServiceLine) { if (contractServiceLine != null) { _databaseCommandObj = _databaseObj.GetStoredProcCommand("GetServiceLinesandPaymentTypes"); // Pass parameters to Stored Procedure(i.e., @ParamName), add values for _databaseObj.AddInParameter(_databaseCommandObj, "@PaymentTypeID ", DbType.Int64, 0); _databaseObj.AddInParameter(_databaseCommandObj, "@ContractID", DbType.Int64, contractServiceLine.ContractId); _databaseObj.AddInParameter(_databaseCommandObj, "@ContractServiceTypeID", DbType.Int64, contractServiceLine.ContractServiceTypeId); _databaseObj.AddInParameter(_databaseCommandObj, "@ServiceLineTypeId", DbType.Int64, contractServiceLine.ServiceLineId); _databaseObj.AddInParameter(_databaseCommandObj, "@UserName", DbType.String, contractServiceLine.UserName); DataSet contractServiceLineDataSet = _databaseObj.ExecuteDataSet(_databaseCommandObj); if (contractServiceLineDataSet.IsTableDataPopulated(0)) { //populating ContractBasicInfo data ContractServiceLine serviceLine = new ContractServiceLine { IncludedCode = Convert.ToString(contractServiceLineDataSet.Tables[0].Rows[0]["IncludedCode"]), ExcludedCode = Convert.ToString(contractServiceLineDataSet.Tables[0].Rows[0]["ExcludedCode"]), ContractServiceLineId = Convert.ToInt64(contractServiceLineDataSet.Tables[0].Rows[0]["ContractServiceLineID"]) }; return(serviceLine); } } //returns response to Business layer return(contractServiceLine); }
public JsonResult AddEditServiceLineCode(ContractServiceLineViewModel serviceLineinfo) { ContractServiceLine modelContractServiceLine = AutoMapper.Mapper.Map <ContractServiceLineViewModel, ContractServiceLine>(serviceLineinfo); //Get the Name of User logged in modelContractServiceLine.UserName = GetCurrentUserName(); long noOfRecord = PostApiResponse <long>("ServiceLineCode", "AddEditServiceLineCodeDetails", modelContractServiceLine); return(noOfRecord > 0 ? Json(new { sucess = true, Id = noOfRecord }) : Json(new { sucess = false })); }
/// <summary> /// Gets all service line code details by contract id. /// </summary> /// <param name="contractId">The contract id.</param> /// <returns></returns> public List <ContractServiceLine> GetAllServiceLineCodeDetailsByContractId(long contractId) { List <ContractServiceLine> serviceLineList = new List <ContractServiceLine>(); if (contractId != 0) { _databaseCommandObj = _databaseObj.GetStoredProcCommand("GetAllServiceLinesByContractId"); DataSet contractServiceLineDataSet = _databaseObj.ExecuteDataSet(_databaseCommandObj); if (contractServiceLineDataSet.IsTableDataPopulated(0)) { serviceLineList = new List <ContractServiceLine>(); for (int i = 0; i < contractServiceLineDataSet.Tables[0].Rows.Count; i++) { ContractServiceLine contractServiceLine = new ContractServiceLine { ContractServiceLineId = long.Parse(contractServiceLineDataSet.Tables[0].Rows[i]["ContractServiceLineID"].ToString()), InsertDate = DBNull.Value == contractServiceLineDataSet.Tables[0].Rows[0]["InsertDate"] ? (DateTime?)null : Convert.ToDateTime(contractServiceLineDataSet.Tables[0].Rows[0]["InsertDate"]), UpdateDate = DBNull.Value == contractServiceLineDataSet.Tables[0].Rows[0]["UpdateDate"] ? (DateTime?)null : Convert.ToDateTime(contractServiceLineDataSet.Tables[0].Rows[0]["UpdateDate"]), // UserId = DBNull.Value == dataset.Tables[0].Rows[0]["UserID"] ? (int?)null : Convert.ToInt32(dataset.Tables[0].Rows[0]["UserID"]), ServiceLineId = DBNull.Value == contractServiceLineDataSet.Tables[0].Rows[0]["ServiceLineID"] ? (long?)null : Convert.ToInt64(contractServiceLineDataSet.Tables[0].Rows[0]["ServiceLineID"]), ContractServiceTypeId = DBNull.Value == contractServiceLineDataSet.Tables[0].Rows[0]["ContractServiceTypeID"] ? (long?)null : Convert.ToInt64(contractServiceLineDataSet.Tables[0].Rows[0]["ContractServiceTypeID"]), ContractId = DBNull.Value == contractServiceLineDataSet.Tables[0].Rows[0]["ContractID"] ? (long?)null : Convert.ToInt64(contractServiceLineDataSet.Tables[0].Rows[0]["ContractID"]), FacilityId = Convert.ToInt32(contractServiceLineDataSet.Tables[0].Rows[0]["FacilityID"]), IncludedCode = Convert.ToString(contractServiceLineDataSet.Tables[0].Rows[i]["IncludedCode"]), Description = Convert.ToString(contractServiceLineDataSet.Tables[0].Rows[i]["Description"]), ExcludedCode = Convert.ToString(contractServiceLineDataSet.Tables[0].Rows[i]["ExcludedCode"]), Status = DBNull.Value == contractServiceLineDataSet.Tables[0].Rows[0]["Status"] ? (int?)null : int.Parse(contractServiceLineDataSet.Tables[0].Rows[0]["Status"].ToString()) }; serviceLineList.Add(contractServiceLine); } } } return(serviceLineList); }
public void AddEditServiceLineCodeDetailsifNotNull() { var mockAddServiceLineCodeDetails = new Mock <IServiceLineCodeRepository>(); mockAddServiceLineCodeDetails.Setup(f => f.AddEditServiceLineCodeDetails(It.IsAny <ContractServiceLine>())).Returns(2); ServiceLineCodeLogic target = new ServiceLineCodeLogic(mockAddServiceLineCodeDetails.Object); ContractServiceLine objServiceLineCodeDetails = new ContractServiceLine { ContractServiceLineId = 1 }; long actual = target.AddEditServiceLineCodeDetails(objServiceLineCodeDetails); Assert.AreEqual(2, actual); }
public List <ServiceLineCode> GetAllServiceLineCodes(ContractServiceLine input) { //TODO: From the controller we are sending an Nullable type, then till business & data layer same type should be send. // From controller we are sending long? and in business & data layer in signature is GetAllServiceLineCodes(long id ) if (input != null) { if (input.ServiceLineId != null) { return(_serviceLineCodeDetailsLogic.GetAllServiceLineCodes(input.ServiceLineId.Value, input.PageSize, input.PageIndex)); } } return(null); }
public void GetServiceLineCodeDetailsUnitTestforNull() { // Arrange var mockGetServiceLineCodeDetails = new Mock <IServiceLineCodeRepository>(); mockGetServiceLineCodeDetails.Setup(f => f.GetServiceLineCodeDetails(It.IsAny <ContractServiceLine>())).Returns((ContractServiceLine)null); var target = new ServiceLineCodeLogic(mockGetServiceLineCodeDetails.Object); // Act ContractServiceLine actual = target.GetServiceLineCodeDetails(null); // Assert Assert.IsNull(actual); }
public void GetServiceLineCodeDetailsUnitTestIfNotNull() { //Mock Input ContractServiceLine inputData = new ContractServiceLine { ContractId = 267, ContractServiceTypeId = null, ServiceLineId = 2 }; //Mock output ContractServiceLine getServiceLineCodeDetails = new ContractServiceLine { IncludedCode = "234", ExcludedCode = "745", ContractServiceLineId = 756 }; var mockGetServiceLineCodeDetails = new Mock <IServiceLineCodeRepository>(); mockGetServiceLineCodeDetails.Setup(f => f.GetServiceLineCodeDetails(inputData)).Returns(getServiceLineCodeDetails); ServiceLineCodeLogic target = new ServiceLineCodeLogic(mockGetServiceLineCodeDetails.Object); ContractServiceLine actual = target.GetServiceLineCodeDetails(inputData); Assert.AreEqual(getServiceLineCodeDetails, actual); }
/// <summary> /// Add & Edit the service line code details. /// </summary> /// <param name="contractServiceLine">The contract service line list.</param> public long AddEditServiceLineCodeDetails(ContractServiceLine contractServiceLine) { //Checks if input request is not null if (contractServiceLine != null) { // Initialize the Stored Procedure _databaseCommandObj = _databaseObj.GetStoredProcCommand("AddEditServiceLinesInfo"); _databaseObj.AddInParameter(_databaseCommandObj, "@ContractServiceLineId", DbType.Int64, contractServiceLine.ContractServiceLineId); _databaseObj.AddInParameter(_databaseCommandObj, "@IncludedCode", DbType.String, contractServiceLine.IncludedCode.ToTrim()); _databaseObj.AddInParameter(_databaseCommandObj, "@ExcludedCode", DbType.String, contractServiceLine.ExcludedCode.ToTrim()); _databaseObj.AddInParameter(_databaseCommandObj, "@ContractId", DbType.Int64, contractServiceLine.ContractId); _databaseObj.AddInParameter(_databaseCommandObj, "@ServiceLineTypeId", DbType.Int64, contractServiceLine.ServiceLineId); _databaseObj.AddInParameter(_databaseCommandObj, "@ContractServiceTypeId", DbType.Int64, contractServiceLine.ContractServiceTypeId); _databaseObj.AddInParameter(_databaseCommandObj, "@UserName", DbType.String, contractServiceLine.UserName); // Retrieve the results of the Stored Procedure in Datatable return(long.Parse(_databaseObj.ExecuteScalar(_databaseCommandObj).ToString())); } return(0); }
// // GET: /ServiceLineCode/ public ActionResult ServiceLineCode(long?contractId, long?serviceTypeId, long serviceLineTypeId, bool isEdit) { ContractServiceLine inputmodel = new ContractServiceLine { ServiceLineId = serviceLineTypeId, PageSize = Convert.ToInt16(GlobalConfigVariable.ServiceLineCodesPageSize), PageIndex = 1 // Sets to first page }; List <ServiceLineCode> codecount = PostApiResponse <List <ServiceLineCode> >("ServiceLineCode", "GetAllServiceLineCodes", inputmodel); ContractServiceLineViewModel model = new ContractServiceLineViewModel(); if (isEdit) { ContractServiceLine contractServiceLineforPost = new ContractServiceLine { ContractId = contractId, ServiceLineId = serviceLineTypeId, ContractServiceTypeId = serviceTypeId, PageSize = Convert.ToInt16(GlobalConfigVariable.ServiceLineCodesPageSize), PageIndex = 1, // Sets to first page TotalRecords = (codecount != null && codecount.Count > 0) ? codecount[0].TotalRecs : 0, UserName = GetCurrentUserName() }; //Get the Name of User logged in ContractServiceLine contractServiceLineViewModelInfo = PostApiResponse <ContractServiceLine>("ServiceLineCode", "GetServiceLineCodeDetails", contractServiceLineforPost); model = AutoMapper.Mapper.Map <ContractServiceLine, ContractServiceLineViewModel>(contractServiceLineViewModelInfo); } model.ContractId = contractId; model.ContractServiceTypeId = serviceTypeId; model.ServiceLineTypeId = serviceLineTypeId; model.IsEdit = isEdit; model.PageIndex = 1;// Sets to first page model.PageSize = Convert.ToInt16(GlobalConfigVariable.ServiceLineCodesPageSize); model.TotalRecords = (codecount != null && codecount.Count > 0) ? codecount[0].TotalRecs : 0; return(View(model)); }
/// <summary> /// Get the all ServiceLine RevenueCodes basing on serviceTypeId /// </summary> /// <exception cref="System.NotImplementedException"></exception> //Storing ServiceLines data into Cache for one day public ContentResult GetServiceLineCodesSelection(long serviceLineTypeId, int pageSize, int pageIndex) { ContractServiceLine inputmodel = new ContractServiceLine { ServiceLineId = serviceLineTypeId, PageSize = pageSize, PageIndex = pageIndex }; List <ServiceLineCode> serviceLineCode = PostApiResponse <List <ServiceLineCode> >("ServiceLineCode", "GetAllServiceLineCodes", inputmodel); var serializer = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue }; var resultData = new { slCodes = serviceLineCode }; //serializing data var result = new ContentResult { Content = serializer.Serialize(resultData), ContentType = "application/json" }; return(result); }
/// <summary> /// Gets the service line code details. /// </summary> /// <param name="contractServiceLine">The contract service line list.</param> /// <returns></returns> public ContractServiceLine GetServiceLineCodeDetails(ContractServiceLine contractServiceLine) { return(_serviceLineCodeDetailsRepository.GetServiceLineCodeDetails(contractServiceLine)); }
/// <summary> /// Adds the service line code details. /// </summary> /// <param name="contractServiceLine">The contract service line list.</param> /// <returns></returns> public long AddEditServiceLineCodeDetails(ContractServiceLine contractServiceLine) { return(_serviceLineCodeDetailsRepository.AddEditServiceLineCodeDetails(contractServiceLine)); }
public ContractServiceLine GetServiceLineCodeDetails(ContractServiceLine contractServiceLine) { return(_serviceLineCodeDetailsLogic.GetServiceLineCodeDetails(contractServiceLine)); }
/// <summary> /// Adds the service line code details. /// </summary> /// <param name="contractServiceLine">The contract service line list.</param> public long AddEditServiceLineCodeDetails(ContractServiceLine contractServiceLine) { return(_serviceLineCodeDetailsLogic.AddEditServiceLineCodeDetails(contractServiceLine)); }