public HttpResponseMessage GetIncomeCustomerRatingOverride(HttpRequestMessage request, int Id) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; IncomeCustomerRatingOverrideTEMP icro = _MPRBSService.GetIncomeCustomerRatingOverrideTEMP(Id); // notice no need to create a seperate model object since AcquirerMapping entity will do just fine response = request.CreateResponse <IncomeCustomerRatingOverrideTEMP>(HttpStatusCode.OK, icro); return response; })); }
//================ methods to call starts IncomeNewDetails ========================================== public IEnumerable <IncomeCustomerRatingOverrideTEMP> IncomeCustomerRatingOverrideTEMP(string status) { List <IncomeCustomerRatingOverrideTEMP> obuList = new List <IncomeCustomerRatingOverrideTEMP>(); using (var con = new System.Data.SqlClient.SqlConnection(connectionString)) { var cmd = new System.Data.SqlClient.SqlCommand("", con); //cmd.CommandText = "select * from Names where Id=@Id"; //cmd.Parameters.AddWithValue("@Id", id); con.Open(); cmd.CommandText = "select top (@TAKETOP) * from Income_CustomerRating_Override_TEMP where ApprovalStatus=@STATUS"; //cmd.CommandText = "select top 500 Id, Cust_ID, Ref_No, Settlement_Account, Customer_Name, Limit, " + // "PrincipalOutstandingBal, Value_Date, Maturity_Date, Risk_Rating, ApprovalStatus " + // "from Income_CustomerRating_Override_TEMP where ApprovalStatus=@STATUS"; cmd.Parameters.AddWithValue("@STATUS", status); cmd.Parameters.AddWithValue("@TAKETOP", taketop); System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { var obu = new IncomeCustomerRatingOverrideTEMP(); obu.Id = reader["Id"] != DBNull.Value ? int.Parse(reader["Id"].ToString()) : 0; obu.Cust_ID = reader["Cust_ID"] != DBNull.Value ? reader["Cust_ID"].ToString() : ""; obu.Ref_No = reader["Ref_No"] != DBNull.Value ? reader["Ref_No"].ToString() : ""; obu.Settlement_Account = reader["Settlement_Account"] != DBNull.Value ? reader["Settlement_Account"].ToString() : ""; obu.Customer_Name = reader["Customer_Name"] != DBNull.Value ? reader["Customer_Name"].ToString() : ""; obu.Limit = reader["Limit"] != DBNull.Value ? Convert.ToDecimal(reader["Limit"].ToString()) : 0; obu.PrincipalOutstandingBal = reader["PrincipalOutstandingBal"] != DBNull.Value ? Convert.ToDecimal(reader["PrincipalOutstandingBal"].ToString()) : 0; //ddb.P_Date = reader["P_Date"] != DBNull.Value ? DateTime.Parse(reader["P_Date"].ToString()) : DateTime.Parse("1000-01-01"); //obu.Value_Date = reader["Value_Date"] != DBNull.Value ? DateTime.Parse(reader["Value_Date"].ToString()) : DateTime.Now; obu.Value_Date = reader["Value_Date"] != DBNull.Value ? DateTime.Parse(reader["Value_Date"].ToString()) : DateTime.Parse("1000-01-01"); obu.Maturity_Date = reader["Maturity_Date"] != DBNull.Value ? DateTime.Parse(reader["Maturity_Date"].ToString()) : DateTime.Parse("1000-01-01"); obu.Risk_Rating = reader["Risk_Rating"] != DBNull.Value ? reader["Risk_Rating"].ToString() : ""; obu.ApprovalStatus = reader["ApprovalStatus"] != DBNull.Value ? reader["ApprovalStatus"].ToString() : ""; obuList.Add(obu); } con.Close(); } return(obuList); }
public HttpResponseMessage DeleteIncomeCustomerRatingOverride(HttpRequestMessage request, [FromBody] int Id) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; // not that calling the WCF service here will authenticate access to the data IncomeCustomerRatingOverrideTEMP icro = _MPRBSService.GetIncomeCustomerRatingOverrideTEMP(Id); if (icro != null) { _MPRBSService.DeleteIncomeCustomerRatingOverrideTEMP(Id); response = request.CreateResponse(HttpStatusCode.OK); } else { response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No record found under that ID."); } return response; })); }
public HttpResponseMessage UpdateIncomeCustomerRatingOverride(HttpRequestMessage request, [FromBody] IncomeCustomerRatingOverrideTEMP icroModel) { return(GetHttpResponse(request, () => { var icro = _MPRBSService.UpdateIncomeCustomerRatingOverrideTEMP(icroModel); return request.CreateResponse <IncomeCustomerRatingOverrideTEMP>(HttpStatusCode.OK, icro); })); }
public IncomeCustomerRatingOverrideTEMP UpdateIncomeCustomerRatingOverrideTEMP(IncomeCustomerRatingOverrideTEMP icro) { return(Channel.UpdateIncomeCustomerRatingOverrideTEMP(icro)); }