public IActionResult SaveShareApplication([FromBody] ShareApplicationDTO ShareApplicationDTO) { shareComfigurationIdandName _shareComfigurationIdandName = new shareComfigurationIdandName(); try { long pShareaccountid = 0; string shareaccountNo = objshareApplication.SaveshareApplication(ShareApplicationDTO, Con, out pShareaccountid); if (!string.IsNullOrEmpty(shareaccountNo)) { _shareComfigurationIdandName.pShareAccountNo = shareaccountNo; _shareComfigurationIdandName.pshareapplicationid = pShareaccountid; return(Ok(_shareComfigurationIdandName)); } else { return(StatusCode(StatusCodes.Status304NotModified)); } } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError)); throw; } }
public string SaveshareApplication(ShareApplicationDTO ShareApplicationDTO, string ConnectionString, out long pShareaccountid) { bool IsSaved = false; StringBuilder sbInsert = new StringBuilder(); Int64 Maxsharetovalue = 0; try { con = new NpgsqlConnection(ConnectionString); if (con.State != ConnectionState.Open) { con.Open(); } trans = con.BeginTransaction(); if (string.IsNullOrEmpty(ShareApplicationDTO.pshareapplicationid.ToString()) || ShareApplicationDTO.pshareapplicationid == 0) { Maxsharetovalue = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(ConnectionString, CommandType.Text, "select coalesce(max(distinctive_to),0) from Share_Account_creation;")); ShareApplicationDTO.pdistinctivefrom = Maxsharetovalue + 1; // ShareApplicationDTO.pdistinctiveto = (Maxsharetovalue + ShareApplicationDTO.pnoofsharesissued) - 1; ShareApplicationDTO.pdistinctiveto = (ShareApplicationDTO.pdistinctivefrom + ShareApplicationDTO.pnoofsharesissued); ShareApplicationDTO.pShareAccountNo = NPGSqlHelper.ExecuteScalar(ConnectionString, CommandType.Text, "SELECT FN_GENERATENEXTID('SHARE CAPITAL','" + ShareApplicationDTO.psharename + "','" + ShareApplicationDTO.pTransdate + "')").ToString(); //ShareApplicationDTO.pShareAccountNo = "sd0001"; ShareApplicationDTO.pshareapplicationid = Convert.ToInt64(NPGSqlHelper.ExecuteScalar(trans, CommandType.Text, "insert into Share_Account_creation(share_Account_number,share_config_id,share_name,member_type_id,member_id,member_name,applicant_type,Trans_date,reference_no,face_value,no_of_shares_issued,distinctive_from,distinctive_to,total_amount,shares_issue_date,is_member_fee_applicable,Bond_print_status,statusid,createdby,createddate)values('" + ShareApplicationDTO.pShareAccountNo + "'," + ShareApplicationDTO.pshareconfigid + ",'" + ManageQuote(ShareApplicationDTO.psharename) + "'," + Convert.ToInt64(ShareApplicationDTO.pmembertypeid) + "," + Convert.ToInt64(ShareApplicationDTO.pmemberid) + ", '" + ManageQuote(ShareApplicationDTO.pmembername) + "','" + ManageQuote(ShareApplicationDTO.pApplicanttype) + "','" + FormatDate(ShareApplicationDTO.pTransdate) + "','" + ManageQuote(ShareApplicationDTO.preferenceno) + "'," + Convert.ToDecimal(ShareApplicationDTO.pfacevalue) + "," + Convert.ToInt64(ShareApplicationDTO.pnoofsharesissued) + "," + Convert.ToInt64(ShareApplicationDTO.pdistinctivefrom) + "," + Convert.ToInt64(ShareApplicationDTO.pdistinctiveto) + "," + Convert.ToDecimal(ShareApplicationDTO.ptotalamount) + ",'" + FormatDate(ShareApplicationDTO.pshareissuedate) + "','" + ShareApplicationDTO.pismemberfeeapplicable + "','N'," + Convert.ToInt32(Status.Active) + "," + ShareApplicationDTO.pCreatedby + ",current_timestamp) returning share_account_id;")); } else { sbInsert.Append("update Share_Account_creation set is_member_fee_applicable='" + ShareApplicationDTO.pismemberfeeapplicable + "', member_type_id=" + Convert.ToInt64(ShareApplicationDTO.pmembertypeid) + ", member_id=" + Convert.ToInt64(ShareApplicationDTO.pmemberid) + ", share_config_id=" + Convert.ToInt64(ShareApplicationDTO.pshareconfigid) + ",reference_no='" + ManageQuote(ShareApplicationDTO.preferenceno) + "', face_value=" + Convert.ToDecimal(ShareApplicationDTO.pfacevalue) + ",no_of_shares_issued=" + Convert.ToInt64(ShareApplicationDTO.pnoofsharesissued) + ", distinctive_from=" + Convert.ToInt64(ShareApplicationDTO.pdistinctivefrom) + ", distinctive_to=" + Convert.ToInt64(ShareApplicationDTO.pdistinctiveto) + ", total_amount=" + Convert.ToDecimal(ShareApplicationDTO.ptotalamount) + ",Share_Joining_date='" + FormatDate(ShareApplicationDTO.pTransdate) + "', shares_issue_date='" + FormatDate(ShareApplicationDTO.pshareissuedate) + "', Bond_print_status='N',modifiedby=" + ShareApplicationDTO.pCreatedby + ",modifieddate=current_timestamp where share_account_id=" + ShareApplicationDTO.pShareaccountid + " and share_account_number=" + ShareApplicationDTO.pShareAccountNo + ";"); if (!string.IsNullOrEmpty(sbInsert.ToString())) { NPGSqlHelper.ExecuteNonQuery(trans, CommandType.Text, sbInsert.ToString()); } } pShareaccountid = ShareApplicationDTO.pshareapplicationid; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw ex; } finally { if (con.State == ConnectionState.Open) { con.Dispose(); con.Close(); con.ClearPool(); trans.Dispose(); } } return(Convert.ToString(ShareApplicationDTO.pShareAccountNo)); }
public ShareApplicationDTO BindShareDetailsBasedonApplicationid(long ShareApplicationid, string ConnectionString) { ShareApplicationDTO objShareApplicationDTO = new ShareApplicationDTO(); //try //{ // using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, "SELECT shareapplicationid,ismemberfeeapplicable,membertypeid, membertype,memberid,membercode,membername,contactid, contacttype, contactreferenceid,sharenamecode, shareconfigid,sharename,referenceno, facevalue,noofsharesissued, distinctivefrom, distinctiveto, totalamount,sharedate, shareissuedate, printstatus, sharestatus, tokenno FROM tbltransshareapplication where shareapplicationid=" + ShareApplicationid + ";")) // { // while (dr.Read()) // { // objShareApplicationDTO.pshareapplicationid = Convert.ToInt64(dr["shareapplicationid"]); // objShareApplicationDTO.pismemberfeeapplicable = Convert.ToBoolean(dr["ismemberfeeapplicable"]); // objShareApplicationDTO.pmembertypeid = Convert.ToInt64(dr["membertypeid"]); // objShareApplicationDTO.pmembertype = Convert.ToString(dr["membertype"]); // objShareApplicationDTO.pmemberid = Convert.ToInt64(dr["memberid"]); // objShareApplicationDTO.pmembercode = Convert.ToString(dr["membercode"]); // objShareApplicationDTO.pmembername = Convert.ToString(dr["membername"]); // objShareApplicationDTO.pcontactid = Convert.ToInt64(dr["contactid"]); // objShareApplicationDTO.pcontacttype = Convert.ToString(dr["contacttype"]); // objShareApplicationDTO.pcontactreferenceid = Convert.ToString(dr["contactreferenceid"]); // objShareApplicationDTO.psharenamecode = Convert.ToString(dr["sharenamecode"]); // objShareApplicationDTO.pshareconfigid = Convert.ToInt64(dr["shareconfigid"]); // objShareApplicationDTO.psharename = Convert.ToString(dr["sharename"]); // objShareApplicationDTO.preferenceno = Convert.ToString(dr["referenceno"]); // objShareApplicationDTO.pfacevalue = Convert.ToDecimal(dr["facevalue"]); // objShareApplicationDTO.pnoofsharesissued = Convert.ToInt64(dr["noofsharesissued"]); // objShareApplicationDTO.pdistinctivefrom = Convert.ToInt64(dr["distinctivefrom"]); // objShareApplicationDTO.pdistinctiveto = Convert.ToInt64(dr["distinctiveto"]); // objShareApplicationDTO.ptotalamount = Convert.ToDecimal(dr["totalamount"]); // } // } //} //catch (Exception ex) //{ // throw ex; //} return(objShareApplicationDTO); }
public async Task <List <ShareApplicationDTO> > BindShareApplicationView(string ConnectionString) { List <ShareApplicationDTO> lstShareApplicationDTO = new List <ShareApplicationDTO>(); await Task.Run(() => { try { using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, "SELECT share_account_id,share_Account_number,share_config_id, member_type_id,member_id,trans_date,reference_no,face_value, no_of_shares_issued, distinctive_from,distinctive_to, total_amount,is_member_fee_applicable,applicant_type,member_name ,(select (case when count(share_account_id)> 0 then true else false end) ReceiptStatus from Share_receipt tt where tt.share_account_id=t.share_account_id)from Share_Account_creation t where statusid = " + Convert.ToInt32(Status.Active) + ";")) { while (dr.Read()) { ShareApplicationDTO objShareApplicationDTO = new ShareApplicationDTO(); objShareApplicationDTO.pshareapplicationid = Convert.ToInt64(dr["share_account_id"]); objShareApplicationDTO.pShareAccountNo = Convert.ToString(dr["share_Account_number"]); objShareApplicationDTO.pshareconfigid = Convert.ToInt64(dr["share_config_id"]); objShareApplicationDTO.pmembertypeid = Convert.ToInt64(dr["member_type_id"]); objShareApplicationDTO.pmemberid = Convert.ToInt64(dr["member_id"]); objShareApplicationDTO.pTransdate = Convert.ToString(dr["trans_date"]); objShareApplicationDTO.preferenceno = Convert.ToString(dr["reference_no"]); objShareApplicationDTO.pfacevalue = Convert.ToDecimal(dr["face_value"]); objShareApplicationDTO.pnoofsharesissued = Convert.ToInt64(dr["no_of_shares_issued"]); objShareApplicationDTO.pdistinctivefrom = Convert.ToInt64(dr["distinctive_from"]); objShareApplicationDTO.pdistinctiveto = Convert.ToInt64(dr["distinctive_to"]); objShareApplicationDTO.ptotalamount = Convert.ToDecimal(dr["total_amount"]); objShareApplicationDTO.pismemberfeeapplicable = Convert.ToBoolean(dr["is_member_fee_applicable"]); objShareApplicationDTO.pApplicanttype = Convert.ToString(dr["applicant_type"]); objShareApplicationDTO.pmembername = Convert.ToString(dr["member_name"]); objShareApplicationDTO.pReceiptStatus = dr["ReceiptStatus"]; lstShareApplicationDTO.Add(objShareApplicationDTO); } } } catch (Exception ex) { throw ex; } }); return(lstShareApplicationDTO); }