//================ methods to call starts IncomeNewDetails ========================================== public IEnumerable <IncomeAccountsTreeAccountTEMP> IncomeAccountsTreeAccountTEMP(string status) { List <IncomeAccountsTreeAccountTEMP> obuList = new List <IncomeAccountsTreeAccountTEMP>(); 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 1000 * from Income_AccountsTree_Accounts_TEMP where ApprovalStatus=@STATUS"; //cmd.CommandText = "select top 500 Id, accountnumber, mis, AccountOfficer_Code, ApprovalStatus from Income_accountMIS_Override_TEMP where ApprovalStatus=@STATUS"; cmd.Parameters.AddWithValue("@STATUS", status); System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { var obu = new IncomeAccountsTreeAccountTEMP(); obu.ID = reader["Id"] != DBNull.Value ? int.Parse(reader["Id"].ToString()) : 0; obu.AccountNumber = reader["AccountNumber"] != DBNull.Value ? reader["AccountNumber"].ToString() : ""; obu.ShareReason = reader["ShareReason"] != DBNull.Value ? reader["ShareReason"].ToString() : ""; obu.ExpirationPeriod = reader["ExpirationPeriod"] != DBNull.Value ? Int32.Parse(reader["ExpirationPeriod"].ToString()) : 0; obu.ExpirationYear = reader["ExpirationYear"] != DBNull.Value ? Convert.ToInt32(reader["ExpirationYear"].ToString()) : 0; obuList.Add(obu); } con.Close(); } return(obuList); }
public HttpResponseMessage GetIncomeAccountsTreeAccount(HttpRequestMessage request, int ID) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; IncomeAccountsTreeAccountTEMP incomeAccountsTreeAccount = _MPRCoreService.GetIncomeAccountsTreeAccountTEMP(ID); // notice no need to create a seperate model object since CaptionMapping entity will do just fine response = request.CreateResponse <IncomeAccountsTreeAccountTEMP>(HttpStatusCode.OK, incomeAccountsTreeAccount); return response; })); }
public HttpResponseMessage DeleteIncomeAccountsTreeAccountTEMP(HttpRequestMessage request, [FromBody] int ID) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; // not that calling the WCF service here will authenticate access to the data IncomeAccountsTreeAccountTEMP incomeAccountsTreeAccount = _MPRCoreService.GetIncomeAccountsTreeAccountTEMP(ID); if (incomeAccountsTreeAccount != null) { _MPRCoreService.DeleteIncomeAccountsTreeAccountTEMP(ID); response = request.CreateResponse(HttpStatusCode.OK); } else { response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No IncomeAccountsTreeAccountTemp found under that ID."); } return response; })); }
public HttpResponseMessage UpdateIncomeAccountsTreeAccountTEMP(HttpRequestMessage request, [FromBody] IncomeAccountsTreeAccountTEMP incomeAccountsTreeAccountModel) { return(GetHttpResponse(request, () => { var incomeAccountsTreeAccount = _MPRCoreService.UpdateIncomeAccountsTreeAccountTEMP(incomeAccountsTreeAccountModel); return request.CreateResponse <IncomeAccountsTreeAccountTEMP>(HttpStatusCode.OK, incomeAccountsTreeAccount); })); }