public IActionResult GetInsurenceReferralDetails(string InsurenceName, string InsurenceNameCode) { insurenceReferralCommissionDTO objinsurenceReferralCommission = new insurenceReferralCommissionDTO(); try { objinsurenceReferralCommission = objInsurenceconfig.GetInsurenceReferralDetails(InsurenceName, InsurenceNameCode, Con); return(objinsurenceReferralCommission != null?Ok(objinsurenceReferralCommission) : (IActionResult)StatusCode(StatusCodes.Status204NoContent)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError)); throw; } }
public bool SaveInsurenceReferralDetails(insurenceReferralCommissionDTO InsurenceReferralDetails, string ConnectionString) { StringBuilder Sbinsert = new StringBuilder(); bool IsSaved = false; try { con = new NpgsqlConnection(ConnectionString); if (con.State != ConnectionState.Open) { con.Open(); } trans = con.BeginTransaction(); if (!string.IsNullOrEmpty(InsurenceReferralDetails.ptypeofoperation) && InsurenceReferralDetails.ptypeofoperation.Trim().ToUpper() == "CREATE") { Sbinsert.Append("insert into tblmstinsuranceconfigreferraldetails(insuranceschemeconfigid,insuranceSchemename,isreferralcommissionapplicable,referralcommissiontype,commissionValue,istdsapplicable,tdsaccountid,tdssection,tdspercentage,statusid,createdby,createddate)values(" + InsurenceReferralDetails.pInsurenceconfigid + ",'" + ManageQuote(InsurenceReferralDetails.pInsurencename) + "'," + InsurenceReferralDetails.pIsreferralcommissionapplicable + ",'" + ManageQuote(InsurenceReferralDetails.pReferralcommissiontype) + "'," + InsurenceReferralDetails.pCommissionValue + "," + InsurenceReferralDetails.pIstdsapplicable + ",'" + ManageQuote(InsurenceReferralDetails.pTdsaccountid) + "','" + ManageQuote(InsurenceReferralDetails.pTdssection) + "'," + InsurenceReferralDetails.pTdspercentage + "," + Convert.ToInt32(Status.Active) + "," + InsurenceReferralDetails.pCreatedby + ",current_timestamp);"); } else if (!string.IsNullOrEmpty(InsurenceReferralDetails.ptypeofoperation) && InsurenceReferralDetails.ptypeofoperation.Trim().ToUpper() == "UPDATE") { } if (!string.IsNullOrEmpty(Sbinsert.ToString())) { NPGSqlHelper.ExecuteNonQuery(trans, CommandType.Text, Sbinsert.ToString()); } trans.Commit(); IsSaved = true; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { if (con.State == ConnectionState.Open) { con.Dispose(); con.Close(); con.ClearPool(); trans.Dispose(); } } return(IsSaved); }
public IActionResult SaveInsurenceReferralDetails([FromBody] insurenceReferralCommissionDTO InsurenceReferralDetails) { try { if (objInsurenceconfig.SaveInsurenceReferralDetails(InsurenceReferralDetails, Con)) { return(Ok(true)); } else { return(StatusCode(StatusCodes.Status304NotModified)); } } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError)); throw; } }
public insurenceReferralCommissionDTO GetInsurenceReferralDetails(string InsurenceName, string InsurenceNameCode, string ConnectionString) { insurenceReferralCommissionDTO InsurenceReferralDetails = new insurenceReferralCommissionDTO(); try { using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, "select insuranceschemeconfigid,insuranceschemename,insuranceschemecode,companycode,branchcode,series,serieslength,insuranceschemenamecode,statusid from tblmstinsuranceconfig where upper(insuranceschemename) = '" + ManageQuote(InsurenceName.ToUpper()) + "' and upper(insuranceschemenamecode) ='" + ManageQuote(InsurenceNameCode.ToUpper()) + "' and statusid = " + Convert.ToInt32(Status.Active) + ";")) { while (dr.Read()) { InsurenceReferralDetails.pInsurenceconfigid = Convert.ToInt64(dr["insuranceschemeconfigid"]); InsurenceReferralDetails.pInsurencename = dr["insuranceschemename"].ToString(); InsurenceReferralDetails.pInsurencenamecode = dr["insuranceschemenamecode"].ToString(); } } using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, "select recordid,insuranceschemeconfigid,insuranceschemename,isreferralcommissionapplicable,referralcommissiontype,commissionvalue,istdsapplicable,tdsaccountid,tdssection,tdspercentage from tblmstinsuranceconfigreferraldetails where insuranceschemeconfigid=" + InsurenceReferralDetails.pInsurenceconfigid + " and upper(insuranceschemename)='" + ManageQuote(InsurenceName.ToUpper()) + "' and statusid = " + Convert.ToInt32(Status.Active) + ";")) { while (dr.Read()) { InsurenceReferralDetails.precordid = Convert.ToInt64(dr["recordid"]); InsurenceReferralDetails.pIsreferralcommissionapplicable = Convert.ToBoolean(dr["isreferralcommissionapplicable"]); InsurenceReferralDetails.pReferralcommissiontype = dr["referralcommissiontype"].ToString(); InsurenceReferralDetails.pCommissionValue = Convert.ToDecimal(dr["commissionvalue"]); InsurenceReferralDetails.pIstdsapplicable = Convert.ToBoolean(dr["istdsapplicable"]); InsurenceReferralDetails.pTdsaccountid = dr["tdsaccountid"].ToString(); InsurenceReferralDetails.pTdssection = dr["tdssection"].ToString(); InsurenceReferralDetails.pTdspercentage = Convert.ToDecimal(dr["tdspercentage"]); InsurenceReferralDetails.pTypeofOperation = "OLD"; } } } catch (Exception ex) { throw ex; } return(InsurenceReferralDetails); }