public List <ContractFilter> GetContractFiltersData(ContractServiceType data) { List <ContractFilter> contractFiltersData = _contractFiltersRepository.GetContractFilters(data); return(contractFiltersData); }
/// <summary> /// Gets the contract service type details. /// </summary> /// <param name="contractServiceType">Type of the contract service.</param> /// <returns></returns> public ContractServiceType GetContractServiceTypeDetails(ContractServiceType contractServiceType) { _cmd = _db.GetStoredProcCommand("GetServiceTypeDetails"); _db.AddInParameter(_cmd, "@ContractServiceTypeId", DbType.Int64, contractServiceType.ContractServiceTypeId); _db.AddInParameter(_cmd, "@ContractId", DbType.Int64, contractServiceType.ContractId); DataSet serviceTypeDataSet = _db.ExecuteDataSet(_cmd); if (serviceTypeDataSet != null && serviceTypeDataSet.Tables.Count > 0) { //populating ContractBasicInfo data if (serviceTypeDataSet.Tables[0].Rows != null && serviceTypeDataSet.Tables[0] != null && serviceTypeDataSet.Tables[0].Rows.Count > 0) { ContractServiceType contractServiceTypeDetails = new ContractServiceType { ContractServiceTypeName = serviceTypeDataSet.Tables[0].Rows[0]["ContractServiceTypeName"].ToString(), Notes = serviceTypeDataSet.Tables[0].Rows[0]["Notes"].ToString(), IsCarveOut = serviceTypeDataSet.Tables[0].Rows[0]["IsCarveOut"] != DBNull.Value && Convert.ToBoolean(serviceTypeDataSet.Tables[0].Rows[0]["IsCarveOut"]), ContractServiceTypeId = Convert.ToInt64(serviceTypeDataSet.Tables[0].Rows[0]["ContractServiceTypeId"].ToString()) }; return(contractServiceTypeDetails); } } return(null); }
/// <summary> /// This action method will be called once you click on 'Add Service Type' in Context menu in tree /// </summary> /// <param name="contractId">contractId where user wants to add new service type</param> /// <param name="nodeId">The node unique identifier.</param> /// <param name="serviceTypeId"></param> /// <param name="isEdit"></param> /// <returns> /// View /// </returns> public ActionResult ContractServiceType(long contractId, long nodeId, long serviceTypeId, bool isEdit) { ContractServiceTypeViewModel model = new ContractServiceTypeViewModel(); if (isEdit) { ContractServiceType contractServiceType = new ContractServiceType { ContractServiceTypeId = serviceTypeId, ContractId = contractId, UserName = GetLoggedInUserName() }; //Get the Name of User logged in ContractServiceType contractServiceTypeInfo = PostApiResponse <ContractServiceType>("ContractServiceType", "GetContractServiceTypeDetails", contractServiceType); model = AutoMapper.Mapper.Map <ContractServiceType, ContractServiceTypeViewModel>(contractServiceTypeInfo); } model.ContractId = contractId; model.ContractNodeId = nodeId; model.IsEdit = isEdit; return(View(model)); }
/// <summary> /// Gets all contract service type list. /// </summary> /// <param name="contractId">The contract identifier.</param> /// <returns></returns> private List <ContractServiceType> GetAllContractServiceTypeList(long contractId) { List <ContractServiceType> contractServiceTypes = new List <ContractServiceType>(); if (contractId != 0) { _cmd = _db.GetStoredProcCommand("GetAllContractServiceTypes"); _db.AddInParameter(_cmd, "@ContractID", DbType.Int64, contractId); DataTable serviceTypeDataTable = _db.ExecuteDataSet(_cmd).Tables[0]; if (serviceTypeDataTable.Rows != null && serviceTypeDataTable.Rows.Count > 0) { for (int i = 0; i < serviceTypeDataTable.Rows.Count; i++) { ContractServiceType contractServiceType = new ContractServiceType { ContractServiceTypeId = long.Parse( serviceTypeDataTable.Rows[i]["ContractServiceTypeId"]. ToString()), ContractServiceTypeName = Convert.ToString( serviceTypeDataTable.Rows[i]["ContractServiceTypeName"]) }; contractServiceTypes.Add(contractServiceType); } } } return(contractServiceTypes); }
public JsonResult IsContractServiceTypeNameExit(ContractServiceTypeViewModel serviceTypeViewModel) { ContractServiceType contractServiceType = AutoMapper.Mapper.Map <ContractServiceTypeViewModel, ContractServiceType>(serviceTypeViewModel); //Get the Name of User logged in contractServiceType.UserName = GetLoggedInUserName(); return(Json(PostApiResponse <bool>(Shared.Helpers.Constants.ContractServiceType, Shared.Helpers.Constants.IsContractServiceTypeNameExit, contractServiceType))); }
public List <ContractFilter> GetContractFiltersDataBasedOnContractId(ContractServiceType data) { if (data != null) { return(_contractFiltersLogic.GetContractFiltersData(data)); } return(new List <ContractFilter>()); }
public JsonResult AddEditServiceDetails(ContractServiceTypeViewModel serviceTypeViewModel) { ContractServiceType contractServiceType = AutoMapper.Mapper.Map <ContractServiceTypeViewModel, ContractServiceType>(serviceTypeViewModel); //Get the Name of User logged in contractServiceType.UserName = GetLoggedInUserName(); long contractServiceTypeId = PostApiResponse <long>("ContractServiceType", "AddEditContractServiceType", contractServiceType); LastExpandedNodeId = serviceTypeViewModel.ContractNodeId; LastHighlightedNodeId = contractServiceTypeId; return(Json(new { insertedContractServiceTypeId = contractServiceTypeId })); }
public void AddEditContractServiceTypeifNotNull() { _mockContractServiceTypeRepository = new Mock <IContractServiceTypeRepository>(); _mockContractServiceTypeRepository.Setup(f => f.AddEditContractServiceType(It.IsAny <ContractServiceType>())).Returns(2); ContractServiceTypeLogic target = new ContractServiceTypeLogic(_mockContractServiceTypeRepository.Object); ContractServiceType objAddEditContractServiceType = new ContractServiceType { ContractServiceTypeId = 1 }; long actual = target.AddEditContractServiceType(objAddEditContractServiceType); Assert.AreEqual(2, actual); }
/// <summary> /// Rename the Contract Service Type by Contract ServiceType id. /// </summary> /// <param name="data">The data.</param> /// <returns></returns> public long RenameContractServiceType(ContractServiceType data) { long contractServiceTypeId; // Initialize the Stored Procedure _cmd = _db.GetStoredProcCommand("RenameContractServiceTypeByID"); // Pass parameters to Stored Procedure(i.e., @ParamName), add values for _db.AddInParameter(_cmd, "@ContractServiceTypeID", DbType.Int64, data.ContractServiceTypeId); _db.AddInParameter(_cmd, "@ContractServiceTypeName", DbType.String, data.ContractServiceTypeName.ToTrim()); _db.AddInParameter(_cmd, "@UserName", DbType.String, data.UserName); // Retrieve the results of the Stored Procedure in Dataset return(long.TryParse(_db.ExecuteScalar(_cmd).ToString(), out contractServiceTypeId) ? contractServiceTypeId : 0); }
/// <summary> /// Checks the contract service type name is unique. /// </summary> /// <param name="contractServiceTypes">The contract service types.</param> /// <returns></returns> public bool IsContractServiceTypeNameExit(ContractServiceType contractServiceTypes) { if (contractServiceTypes != null) { _cmd = _db.GetStoredProcCommand("IsContractServiceTypeNameExit"); _db.AddInParameter(_cmd, "@ContractId", DbType.Int64, contractServiceTypes.ContractId); _db.AddInParameter(_cmd, "@ContractServiceTypeName", DbType.String, contractServiceTypes.ContractServiceTypeName.ToTrim()); _db.AddInParameter(_cmd, "@ContractServiceTypeID", DbType.Int64, contractServiceTypes.ContractServiceTypeId); return(Convert.ToInt32(_db.ExecuteScalar(_cmd)) == 0); } return(false); }
/// <summary> /// Gets the line level contract log list. /// </summary> /// <param name="paymentResultKeyValuePair">The payment result key value pair.</param> /// <param name="contract">The contract.</param> /// <returns></returns> private static IEnumerable <ContractLog> GetLineLevelContractLogList(KeyValuePair <long, List <PaymentResult> > paymentResultKeyValuePair, Contract contract) { List <ContractLog> contractLogs = new List <ContractLog>(); List <PaymentResult> paymentResults = paymentResultKeyValuePair.Value.Where(q => q.Line != null).ToList(); if (paymentResults.Any()) { long? contractId = contract != null ? contract.ContractId : (long?)null; string contractName = contract != null ? contract.ContractName : string.Empty; foreach (PaymentResult paymentResult in paymentResults) { ContractLog contractLog = new ContractLog { ClaimId = paymentResult.ClaimId, ContractId = contractId, ContractName = contractName, ServiceLine = paymentResult.Line }; EnumHelper enumHelperClaimCharge = EnumHelperLibrary.GetFieldInfoFromEnum((Enums.AdjudicationOrVarianceStatuses)paymentResult.ClaimStatus); contractLog.StatusCode = enumHelperClaimCharge.FieldName; if (contract != null && paymentResult.ServiceTypeId.HasValue) { ContractServiceType contractServiceType = contract.ContractServiceTypes.FirstOrDefault( q => q.ContractServiceTypeId == paymentResult.ServiceTypeId); if (contractServiceType != null) { contractLog.ServiceTypeName = contractServiceType.ContractServiceTypeName; contractLogs.Add(GetLineItemFoundLog(paymentResult, contractId, contractName, contractServiceType.ContractServiceTypeName)); if (paymentResult.PaymentTypeId.HasValue) { EnumHelper enumHelperPaymentType = EnumHelperLibrary.GetFieldInfoFromEnum((Enums.PaymentTypeCodes)paymentResult.PaymentTypeId.Value); contractLog.PaymentType = enumHelperPaymentType.FieldName; } } } contractLog.InsertDate = DateTime.UtcNow; contractLogs.Add(contractLog); } } return(contractLogs); }
/// <summary> /// Copies the Contract Service Type by Contract ServiceType id. /// </summary> /// <param name="data">The data.</param> /// <returns></returns> public long CopyContractServiceType(ContractServiceType data) { if (data != null) { long contractServiceTypeId; _cmd = _db.GetStoredProcCommand("CopyContractServiceTypeByID"); _db.AddInParameter(_cmd, "@ContractServiceTypeID", DbType.Int64, data.ContractServiceTypeId); _db.AddInParameter(_cmd, "@ContractServiceTypeName", DbType.String, data.ContractServiceTypeName.ToTrim()); _db.AddInParameter(_cmd, "@UserName", DbType.String, data.UserName); _cmd.CommandTimeout = data.CommandTimeoutForContractHierarchyCopyContractServiceTypeById; return(long.TryParse(_db.ExecuteScalar(_cmd).ToString(), out contractServiceTypeId) ? contractServiceTypeId : 0); } return(0); }
/// <summary> /// Adds the type of the edit contract service. /// </summary> /// <param name="contractServiceTypes">The contract service types.</param> /// <returns></returns> public long AddEditContractServiceType(ContractServiceType contractServiceTypes) { if (contractServiceTypes != null) { _cmd = _db.GetStoredProcCommand("AddEditContractServiceTypes"); _db.AddInParameter(_cmd, "@ContractServiceTypeId", DbType.Int64, contractServiceTypes.ContractServiceTypeId); _db.AddInParameter(_cmd, "@ContractId", DbType.Int64, contractServiceTypes.ContractId); _db.AddInParameter(_cmd, "@ContractServiceTypeName", DbType.String, contractServiceTypes.ContractServiceTypeName.ToTrim()); _db.AddInParameter(_cmd, "@Notes", DbType.String, contractServiceTypes.Notes.ToTrim()); _db.AddInParameter(_cmd, "@IsCarveOut", DbType.Int64, contractServiceTypes.IsCarveOut); _db.AddInParameter(_cmd, "@UserName", DbType.String, contractServiceTypes.UserName); long returnValue = long.Parse(_db.ExecuteScalar(_cmd).ToString()); return(returnValue); } return(0); }
public JsonResult RenameContractServiceType(TreeViewModel renamerequest) { ContractServiceType contratServiceType = new ContractServiceType { ContractServiceTypeName = renamerequest.NodeText, ContractServiceTypeId = renamerequest.ContractServiceTypeId, UserName = GetLoggedInUserName() }; // LastExpandedNodeId is set to store the nodeID into session and on the next page load, it expands the tree view to node location. LastExpandedNodeId = renamerequest.NodeId; LastHighlightedNodeId = renamerequest.ContractServiceTypeId; long serviceType = PostApiResponse <long>(Constants.ContractServiceType, Constants.RenameContractServiceType, contratServiceType); return(Json(serviceType)); }
/// <summary> /// Gets the contract filters data. /// </summary> /// <param name="data">The data.</param> /// <returns></returns> public List <ContractFilter> GetContractFilters(ContractServiceType data) { //holds the response data List <ContractFilter> contractFilterData = new List <ContractFilter>(); // Initialize the Stored Procedure _databaseCommand = _databaseObj.GetStoredProcCommand("GetContractFiltersDataBasedOnContractId"); _databaseObj.AddInParameter(_databaseCommand, "@ContractId", DbType.Int64, data.ContractId); _databaseObj.AddInParameter(_databaseCommand, "@ContractServiceTypeID", DbType.Int64, data.ContractServiceTypeId); _databaseObj.AddInParameter(_databaseCommand, "@UserName", DbType.String, data.UserName); // Retrieve the results of the Stored Procedure DataSet dataSetObj = _databaseObj.ExecuteDataSet(_databaseCommand); //Map datatable to business objects // sending 0 to insure that table at index is having valid data. if (dataSetObj.IsTableDataPopulated(0)) { DataTable dataTable = dataSetObj.Tables[0]; for (int indexCount = 0; indexCount < dataTable.Rows.Count; indexCount++) { ContractFilter tempData = new ContractFilter { FilterName = Convert.ToString(dataTable.Rows[indexCount]["FilterName"]), FilterValues = Convert.ToString(dataTable.Rows[indexCount]["FilterValues"]), IsServiceTypeFilter = DBNull.Value == dataTable.Rows[indexCount]["IsServiceTypeFilter"] ? (bool?)null : Convert.ToBoolean(dataTable.Rows[indexCount]["IsServiceTypeFilter"].ToString()), PaymentTypeId = DBNull.Value == dataTable.Rows[indexCount]["PaymentTypeID"] ? (long?)null : long.Parse(dataTable.Rows[indexCount]["PaymentTypeID"].ToString()), ServiceLineTypeId = DBNull.Value == dataTable.Rows[indexCount]["ServiceLineTypeId"] ? (long?)null : long.Parse(dataTable.Rows[indexCount]["ServiceLineTypeId"].ToString()) }; contractFilterData.Add(tempData); } //returns the response to Business layer return(contractFilterData); } return(null); }
public void GetContractFiltersDataTest() { var mockGetContractFiltersDataBasedOnContractId = new Mock <IContractFilterRepository>(); //Mock Input ContractServiceType inputData = new ContractServiceType { ContractId = 234, ContractServiceTypeId = 0 }; //Mock output List <ContractFilter> result = new List <ContractFilter> { new ContractFilter { FilterName = "Bill Type", FilterValues = "23,45,67" } }; mockGetContractFiltersDataBasedOnContractId.Setup(f => f.GetContractFilters(inputData)).Returns(result); ContractFilterLogic target = new ContractFilterLogic(mockGetContractFiltersDataBasedOnContractId.Object); List <ContractFilter> actual = target.GetContractFiltersData(inputData); Assert.AreEqual(result, actual); }
/// <summary> /// Gets the contract filters data based on contract id. /// </summary> /// <param name="contractId">The contract id.</param> /// <param name="contractServiceTypeId">The contract service type id.</param> /// <returns></returns> public ActionResult GetContractFiltersDataBasedOnContractId(long contractId, long contractServiceTypeId) { // When Contract Service Type ID is not null, send Contract Service ID and Contract ID = 0 Else send Contract ID and Contract Service Type ID = 0 // Send two parameter ContractServiceType data = new ContractServiceType { ContractId = contractId, ContractServiceTypeId = contractServiceTypeId, UserName = GetCurrentUserName() }; //Get the Name of User logged in List <ContractFilter> response = PostApiResponse <List <ContractFilter> >("ContractFilter", "GetContractFiltersDataBasedOnContractId", data); List <ContractFiltersViewModel> contractFiltersList = AutoMapper.Mapper.Map <List <ContractFilter>, List <ContractFiltersViewModel> >(response); return(View("ContractServiceFilterList", contractFiltersList)); }
public JsonResult CopyContractServiceTypeById(TreeViewModel copyrequest) { //Get the UserName logged in ContractServiceType contratServiceType = new ContractServiceType { ContractServiceTypeName = copyrequest.RenameText, ContractServiceTypeId = copyrequest.ContractServiceTypeId, UserName = GetLoggedInUserName(), CommandTimeoutForContractHierarchyCopyContractServiceTypeById = Convert.ToInt32(GlobalConfigVariable.CommandTimeoutForContractHierarchy) }; long contarctid = PostApiResponse <long>(Constants.ContractServiceType, Constants.CopyContractServiceTypeById, contratServiceType); bool isSuccess = contarctid != 0; // LastExpandedNodeId is set to store the nodeID into session and on the next page load, it expands the tree view to node location. LastExpandedNodeId = copyrequest.NodeId;//copyrequest.NodeId; LastHighlightedNodeId = contarctid; return(Json(new { sucess = isSuccess, addedId = contarctid })); }
/// <summary> /// Add/Edit ContractServiceType based on passed ContractServiceTypes object /// </summary> /// <param name="contractServiceTypes">ContractServiceTypes</param> /// <returns>Inserted/Updated ContractServiceTypeId</returns> public bool IsContractServiceTypeNameExit(ContractServiceType contractServiceTypes) { return(_contractServiceTypeRepository.IsContractServiceTypeNameExit(contractServiceTypes)); }
/// <summary> /// Add/Edit ContractServiceType based on passed ContractServiceTypes object /// </summary> /// <param name="contractServiceTypes">ContractServiceTypes</param> /// <returns>Inserted/Updated ContractServiceTypeId</returns> public long AddEditContractServiceType(ContractServiceType contractServiceTypes) { return(_contractServiceTypeRepository.AddEditContractServiceType(contractServiceTypes)); }
/// <summary> /// Copies the contract serviceType by contract service type unique identifier. /// </summary> /// <param name="data">The data.</param> /// <returns></returns> public long CopyContractServiceType(ContractServiceType data) { return(_contractServiceTypeRepository.CopyContractServiceType(data)); }
/// <summary> /// Rename the contract serviceType by contract service type unique identifier. /// </summary> /// <param name="data">The data.</param> /// <returns></returns> public long RenameContractServiceType(ContractServiceType data) { return(_contractServiceTypeRepository.RenameContractServiceType(data)); }
/// <summary> /// Gets the contract service type details. /// </summary> /// <param name="data">The data.</param> /// <returns></returns> public ContractServiceType GetContractServiceTypeDetails(ContractServiceType data) { return(_contractServiceTypeRepository.GetContractServiceTypeDetails(data)); }
public long RenameContractServiceType(ContractServiceType data) { return(data != null?_serviceTypeDetailsLogic.RenameContractServiceType(data) : 0); }
public long AddEditContractServiceType(ContractServiceType contractServiceTypes) { return(_serviceTypeDetailsLogic.AddEditContractServiceType(contractServiceTypes)); }
public ContractServiceType GetContractServiceTypeDetails(ContractServiceType contractServiceType) { return(_serviceTypeDetailsLogic.GetContractServiceTypeDetails(contractServiceType)); }
public bool IsContractServiceTypeNameExit(ContractServiceType contractServiceTypes) { return(_serviceTypeDetailsLogic.IsContractServiceTypeNameExit(contractServiceTypes)); }
public long CopyContractServiceTypeById(ContractServiceType moduleToCopy) { return(_serviceTypeDetailsLogic.CopyContractServiceType(moduleToCopy)); }