public bool SaveSelforAdjustment(SelfAdjustmentConfigDTO Selfadjustment, string Connectionstring) { bool IsSaved = false; StringBuilder SbInsert = new StringBuilder(); try { con = new NpgsqlConnection(Connectionstring); if (con.State != ConnectionState.Open) { con.Open(); } trans = con.BeginTransaction(); if (string.IsNullOrEmpty(Selfadjustment.pRecordid.ToString()) || Selfadjustment.pRecordid == 0) { SbInsert.Append("insert into self_or_adjustment(self_or_adjustment_date,member_id,fd_account_id,company_name,branch_name,group_code_ticket_no,chit_person_name,Payment_type,bank_name,bank_branch,bank_account_no,ifsc_code,status)values('" + Selfadjustment.pTransdate + "'," + Selfadjustment.pMemberid + "," + Selfadjustment.pFdaccountid + ",'" + Selfadjustment.pCompnayname + "','" + Selfadjustment.pBranchname + "','" + Selfadjustment.pGroupcodeticketno + "','" + Selfadjustment.pChitpersonname + "','" + Selfadjustment.pPaymenttype + "','" + Selfadjustment.pBankname + "','" + Selfadjustment.pBranchname + "','" + Selfadjustment.pBankaccountno + "','" + Selfadjustment.pIfsccode + "',true);"); } else { SbInsert.Append("update table self_or_adjustment set self_or_adjustment_date='" + Selfadjustment.pTransdate + "',company_name='" + ManageQuote(Selfadjustment.pCompnayname) + "',branch_name='" + ManageQuote(Selfadjustment.pBranchname) + ",member_id=" + Selfadjustment.pMemberid + ",fd_account_id=" + Selfadjustment.pFdaccountid + ",group_code_ticket_no='" + ManageQuote(Selfadjustment.pGroupcodeticketno) + "',chit_person_name='" + ManageQuote(Selfadjustment.pChitpersonname) + "',Payment_type='" + ManageQuote(Selfadjustment.pPaymenttype) + "',bank_name='" + ManageQuote(Selfadjustment.pBankname) + "',bank_branch='" + ManageQuote(Selfadjustment.pBankbranch) + "',bank_account_no='" + ManageQuote(Selfadjustment.pBankaccountno) + "',ifsc_code='" + ManageQuote(Selfadjustment.pIfsccode) + "' where recordid=" + Selfadjustment.pRecordid + ")"); } 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 SaveSelforAdjustment([FromBody] SelfAdjustmentConfigDTO Selfadjustment) { try { if (objSelfAdjustment.SaveSelforAdjustment(Selfadjustment, Con)) { return(Ok(true)); } else { return(StatusCode(StatusCodes.Status304NotModified)); } } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError)); throw; } }
public async Task <List <SelfAdjustmentConfigDTO> > ViewSelfAdjustmendtetails(string ConnectionString) { List <SelfAdjustmentConfigDTO> lstSelfAdjustment = new List <SelfAdjustmentConfigDTO>(); await Task.Run(() => { try { using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, "select self_or_adjustment_id,to_char(self_or_adjustment_date, 'dd/Mon/yyyy') self_or_adjustment_date,member_id,tm.membername,fd_account_id,fdaccountno,company_name,branch_name,group_code_ticket_no,chit_person_name,Payment_type,bank_name,bank_branch,bank_account_no,ifsc_code,status from self_or_adjustment sa join tbltransfdcreation tf on sa.fd_account_id=tf.fdaccountid join tblmstmembers tm on sa.member_id=tm.memberid where status=true order by self_or_adjustment_id desc")) { while (dr.Read()) { SelfAdjustmentConfigDTO objSelfAdjustment = new SelfAdjustmentConfigDTO(); objSelfAdjustment.pRecordid = Convert.ToInt64(dr["self_or_adjustment_id"]); objSelfAdjustment.pTransdate = Convert.ToString(dr["self_or_adjustment_date"]); objSelfAdjustment.pMemberid = Convert.ToInt64(dr["member_id"]); objSelfAdjustment.pFdaccountid = Convert.ToInt64(dr["fd_account_id"]); objSelfAdjustment.pCompnayname = Convert.ToString(dr["company_name"]); objSelfAdjustment.pBranchname = Convert.ToString(dr["branch_name"]); objSelfAdjustment.pChitpersonname = Convert.ToString(dr["chit_person_name"]); objSelfAdjustment.pPaymenttype = Convert.ToString(dr["Payment_type"]); objSelfAdjustment.pBankname = Convert.ToString(dr["bank_name"]); objSelfAdjustment.pBankbranch = Convert.ToString(dr["bank_branch"]); objSelfAdjustment.pBankaccountno = Convert.ToString(dr["bank_account_no"]); objSelfAdjustment.pIfsccode = Convert.ToString(dr["ifsc_code"]); objSelfAdjustment.pGroupcodeticketno = Convert.ToString(dr["group_code_ticket_no"]); objSelfAdjustment.pMemberName = Convert.ToString(dr["membername"]); objSelfAdjustment.pFdAccountno = Convert.ToString(dr["fdaccountno"]); lstSelfAdjustment.Add(objSelfAdjustment); } } } catch (Exception ex) { throw ex; } }); return(lstSelfAdjustment); }
public async Task <List <SelfAdjustmentConfigDTO> > GetSelfAdjustmendtetailsByid(int memberid, int fdid, string ConnectionString) { List <SelfAdjustmentConfigDTO> lstSelfAdjustment = new List <SelfAdjustmentConfigDTO>(); await Task.Run(() => { try { using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, "select self_or_adjustment_id,self_or_adjustment_date,member_id,fd_account_id,company_name,branch_name,group_code_ticket_no,chit_person_name,Payment_type,bank_name,bank_branch,bank_account_no,ifsc_code,status from self_or_adjustment where member_id=" + memberid + " and fd_account_id=" + fdid + " and status=true")) { while (dr.Read()) { SelfAdjustmentConfigDTO objSelfAdjustment = new SelfAdjustmentConfigDTO(); objSelfAdjustment.pRecordid = Convert.ToInt64(dr["self_or_adjustment_id"]); objSelfAdjustment.pTransdate = Convert.ToString(dr["self_or_adjustment_date"]); objSelfAdjustment.pMemberid = Convert.ToInt64(dr["member_id"]); objSelfAdjustment.pFdaccountid = Convert.ToInt64(dr["fd_account_id"]); objSelfAdjustment.pCompnayname = Convert.ToString(dr["company_name"]); objSelfAdjustment.pBranchname = Convert.ToString(dr["branch_name"]); objSelfAdjustment.pChitpersonname = Convert.ToString(dr["chit_person_name"]); objSelfAdjustment.pPaymenttype = Convert.ToString(dr["Payment_type"]); objSelfAdjustment.pBankname = Convert.ToString(dr["bank_name"]); objSelfAdjustment.pBankbranch = Convert.ToString(dr["bank_branch"]); objSelfAdjustment.pBankaccountno = Convert.ToString(dr["bank_account_no"]); objSelfAdjustment.pIfsccode = Convert.ToString(dr["ifsc_code"]); objSelfAdjustment.pGroupcodeticketno = Convert.ToString(dr["group_code_ticket_no"]); lstSelfAdjustment.Add(objSelfAdjustment); } } } catch (Exception ex) { throw ex; } }); return(lstSelfAdjustment); }