public void ApprovedSingleCheck(PaymentInfoBO paymentInfoBo)// Approved Check { DataTable dtMaturity = new DataTable(); int maturityDays = 0; dtMaturity = GetPaymentMediaMaturityDay(paymentInfoBo.IsMatureToday, paymentInfoBo.PaymentMedia); if (dtMaturity.Rows.Count > 0) { if (dtMaturity.Rows[0][0] != DBNull.Value) { maturityDays = Convert.ToInt32(dtMaturity.Rows[0][0]); } } string queryUpdateRequisition = "UPDATE SBP_Check_Requisition SET Is_Approved=1 WHERE Sl_No=" + paymentInfoBo.RequisitionId + ""; /*string queryInsertPayment = "INSERT INTO SBP_Payment(Cust_code,Amount,Received_Date,Payment_Media,Maturity_Days,Payment_Media_No,Payment_Media_Date,Bank_Name,Bank_Branch,Received_By,Deposit_Withdraw,Voucher_Sl_No,Payment_Approved_By,Payment_Approved_Date,Remarks,Entry_Date,Entry_By,Requisition_ID,Entry_Branch_ID)" + * " VALUES('" + paymentInfoBo.CustCode + "'," + paymentInfoBo.Amount + ",(CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME)),'" + paymentInfoBo.PaymentMedia + "'," + maturityDays + ",'" + paymentInfoBo.PaymentMediaNo + "','" + paymentInfoBo.PaymentMediaDate.ToShortDateString() + "','" + paymentInfoBo.BankName + "','" + paymentInfoBo.BranchName + "','" + paymentInfoBo.RecievedBy + "','" + paymentInfoBo.DepositWithdraw + "','" + paymentInfoBo.VoucherSlNo + "','" + paymentInfoBo.PaymentApprovedBy + "',CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME),'" + paymentInfoBo.Remarks + "',CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME),'" + GlobalVariableBO._userName + "'," + paymentInfoBo.RequisitionId + "," + GlobalVariableBO._branchId + ")";*/ string queryInsertPayment = "INSERT INTO dbo.SBP_Payment( Cust_Code , Amount ,Received_Date ,Payment_Media ,Payment_Media_No ,Received_By ,Deposit_Withdraw ,Payment_Approved_By ,Payment_Approved_Date ,Remarks ,Entry_Date ,Entry_By ,Maturity_Days ,Requisition_ID ,Entry_Branch_ID)SELECT Cust_Code ,Amount ,(CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME)) ,'Check' ,'' ,Received_By ,'Withdraw','" + GlobalVariableBO._userName + "',Requisition_Date,Remarks ,Entry_Date ,Entry_By ," + maturityDays + ",Sl_No ,Entry_Branch_ID FROM dbo.SBP_Check_Requisition WHERE Sl_No=" + paymentInfoBo.RequisitionId; string queryStringTemp = "INSERT INTO SBP_Money_Balance_Temp(Cust_Code,Sell_Deposit,Buy_Withdraw,Balance,Matured_Balance,Remarks,Rec_Date)" + " VALUES('" + paymentInfoBo.CustCode + "',0," + paymentInfoBo.Amount + "," + (0 - paymentInfoBo.Amount) + "," + (0 - paymentInfoBo.Amount) + ",'" + paymentInfoBo.PaymentMedia + "',(CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME)));"; try { _dbConnection.ConnectDatabase(); _dbConnection.StartTransaction(); _dbConnection.ExecuteNonQuery(queryUpdateRequisition); _dbConnection.ExecuteNonQuery(queryInsertPayment); _dbConnection.ExecuteNonQuery(queryStringTemp); _dbConnection.Commit(); } catch (Exception) { _dbConnection.Rollback(); } finally { _dbConnection.CloseDatabase(); } }
public void InsertintoPaymentPosting(PaymentInfoBO paymentInfoBo, Payment_PostingBO postBo)// For Web { string queryString = ""; string queryDeleteWebData = ""; Int32 AAA = postBo.OnlineOrderNo; CommonBAL commonBAL = new CommonBAL(); Web2014DataForwardBAL webBal = new Web2014DataForwardBAL(); paymentInfoBo.PaymentId = commonBAL.GenerateID("SBP_Payment_Posting_Request", "Payment_ID"); DataTable dtMaturity = new DataTable(); int maturityDays = 0; //dtMaturity = GetPaymentMediaMaturityDay(paymentInfoBo.IsMatureToday, paymentInfoBo.PaymentMedia); if (dtMaturity.Rows.Count > 0) { if (dtMaturity.Rows[0][0] != DBNull.Value) { maturityDays = Convert.ToInt32(dtMaturity.Rows[0][0]); } } { queryString = @"INSERT INTO SBP_Payment_Posting_Request( --Payment_ID --, Cust_code ,Amount ,Received_Date ,Payment_Media ,Maturity_Days ,Payment_Media_No ,Payment_Media_Date ,Bank_ID ,Bank_Name ,Branch_ID ,Bank_Branch ,RoutingNo ,BankAccNo ,Received_By ,Deposit_Withdraw ,Payment_Approved_By ,Payment_Approved_Date ,Remarks ,Entry_Date ,Entry_By ,Deposit_Bank_Name ,Deposit_Branch_Name ,Approval_Status ,Vouchar_SN ,Entry_Branch_ID ,OnlineOrderNo ,Channel ,OnlineEntry_Date )" + " VALUES(" //+ paymentInfoBo.PaymentId //+ ",'" + "'" + paymentInfoBo.CustCode + "'," + paymentInfoBo.Amount + ",'" + paymentInfoBo.RecievedDate.ToString("MM-dd-yyyy") + "','" + paymentInfoBo.PaymentMedia + "'," + maturityDays + ",'" + paymentInfoBo.PaymentMediaNo + "','" + paymentInfoBo.PaymentMediaDate.ToString("MM-dd-yyyy") + "','" + paymentInfoBo.Bank_ID + "','" + paymentInfoBo.BankName + "','" + paymentInfoBo.Branch_ID + "','" + paymentInfoBo.BranchName + "','" + paymentInfoBo.RoutingNo + "','" + paymentInfoBo.BankAccNo + "','" + paymentInfoBo.RecievedBy + "','" + paymentInfoBo.DepositWithdraw + "','" + paymentInfoBo.PaymentApprovedBy + "'," + ((Convert.ToString(paymentInfoBo.PaymentApprovedDate) == string.Empty) ? "null" : "'" + paymentInfoBo.PaymentApprovedDate.Value.ToString("MM-dd-yyyy") + "'") + ",'" + paymentInfoBo.Remarks + "',CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME),'" + GlobalVariableBO._userName + "','" + "" + "','" + "" + "',1,'" + paymentInfoBo.VoucherSlNo + "'," + GlobalVariableBO._branchId + "," + postBo.OnlineOrderNo + ",'" + postBo.Channel + "','" + Convert.ToString(postBo.OnlineEntry_Date.Date.Equals(DateTime.MinValue.Date) ? string.Empty : postBo.OnlineEntry_Date.ToString("MM-dd-yyyy")) + "')"; } if (postBo.OnlineOrderNo != 0 && postBo.OnlineOrderNo != null) { queryDeleteWebData = webBal.DeleteFrom_Web2014_WithdrawalRequest_Temp(postBo.OnlineOrderNo); } try { _dbConnection.ConnectDatabase(); _dbConnection.StartTransaction(); _dbConnection.ExecuteNonQuery(queryString); if (postBo.OnlineOrderNo != 0 && postBo.OnlineOrderNo != null) { _dbConnection.ExecuteNonQuery(queryDeleteWebData); } _dbConnection.Commit(); } catch (Exception ex) { _dbConnection.Rollback(); throw ex; } finally { _dbConnection.CloseDatabase(); } }
public void InsertDW_ReturnInfo_IntoPaymentPosting(PaymentInfoBO paymentInfoBo)//, string depositBank, string depositBranch) { string queryString = ""; CommonBAL commonBAL = new CommonBAL(); paymentInfoBo.PaymentId = commonBAL.GenerateID("SBP_Payment_Posting_Request", "Payment_ID"); #region //DataTable dtMaturity = new DataTable(); //int maturityDays = 0; //dtMaturity = GetPaymentMediaMaturityDay(paymentInfoBo.IsMatureToday, paymentInfoBo.PaymentMedia); //if (dtMaturity.Rows.Count > 0) //{ // if (dtMaturity.Rows[0][0] != DBNull.Value) // maturityDays = Convert.ToInt32(dtMaturity.Rows[0][0]); //} //if (paymentInfoBo.DepositWithdraw == "Withdraw" && paymentInfoBo.PaymentMedia == Indication_PaymentTransaction.Cash) //{ // queryString = "INSERT INTO SBP_Payment_Posting_Request( Payment_ID , Cust_code,Amount , Received_Date , Payment_Media , Maturity_Days , Payment_Media_No , Payment_Media_Date, Bank_Name ,Bank_Branch , RoutingNo , BankAccNo , Received_By, Deposit_Withdraw , Payment_Approved_By , Payment_Approved_Date , Remarks , Entry_Date ,Entry_By , Deposit_Bank_Name,Deposit_Branch_Name,Approval_Status,Vouchar_SN,Entry_Branch_ID)" + // " VALUES(" + paymentInfoBo.PaymentId + ",'" + paymentInfoBo.CustCode + "'," + paymentInfoBo.Amount + ",'" + paymentInfoBo.RecievedDate.ToString("MM-dd-yyyy") + "','" + paymentInfoBo.PaymentMedia + "'," + maturityDays + ",'" + "" + "','" + paymentInfoBo.PaymentMediaDate.ToString("MM-dd-yyyy") + "','" + paymentInfoBo.RoutingNo + "','" + paymentInfoBo.BankAccNo + "','" + "" + "','" + "" + "','" + paymentInfoBo.RecievedBy + "','" + paymentInfoBo.DepositWithdraw + "','" + paymentInfoBo.PaymentApprovedBy + "'," + ((Convert.ToString(paymentInfoBo.PaymentApprovedDate) == string.Empty) ? "null" : "'" + paymentInfoBo.PaymentApprovedDate.Value.ToString("MM-dd-yyyy") + "'") + ",'" + paymentInfoBo.Remarks + "',CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME),'" + GlobalVariableBO._userName + "','" + "" + "','" + "" + "',0,'" + paymentInfoBo.VoucherSlNo + "'," + GlobalVariableBO._branchId + ")"; //} //else //{ //queryString = "INSERT INTO SBP_Payment_Posting_Request(Payment_ID,Cust_code,Amount,Received_Date,Payment_Media,Maturity_Days,Payment_Media_No,Payment_Media_Date,Bank_Name,Bank_Branch,RoutingNo,BankAccNo,Received_By,Deposit_Withdraw,Payment_Approved_By,Payment_Approved_Date,Remarks,Entry_Date,Entry_By,Deposit_Bank_Name,Deposit_Branch_Name,Approval_Status,Vouchar_SN,Entry_Branch_ID)" + // " VALUES(" + paymentInfoBo.PaymentId + ",'" + paymentInfoBo.CustCode + "'," + paymentInfoBo.Amount + ",'" + paymentInfoBo.RecievedDate.ToString("MM-dd-yyyy") + "','" + paymentInfoBo.PaymentMedia + "'," + maturityDays + ",'" + paymentInfoBo.PaymentMediaNo + "','" + paymentInfoBo.PaymentMediaDate.ToString("MM-dd-yyyy") + "','" + paymentInfoBo.BankName + "','" + paymentInfoBo.BranchName + "','" + paymentInfoBo.RoutingNo + "','" + paymentInfoBo.BankAccNo + "','" + paymentInfoBo.RecievedBy + "','" + paymentInfoBo.DepositWithdraw + "','" //+ paymentInfoBo.PaymentApprovedBy + "'," + ((Convert.ToString(paymentInfoBo.PaymentApprovedDate) == string.Empty) ? "null" : "'" + paymentInfoBo.PaymentApprovedDate.Value.ToString("MM-dd-yyyy") + "'") + ",'" + paymentInfoBo.Remarks //+ "',CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME),'" + GlobalVariableBO._userName + "','" + paymentInfoBo.BankName + "','" + paymentInfoBo.BranchName + "',0,'" + paymentInfoBo.VoucherSlNo + "'," + GlobalVariableBO._branchId + ")"; // queryString = @"INSERT INTO SBP_Payment_Posting_Request // ( // Payment_ID // ,Cust_code // ,Amount // ,Received_Date // ,Payment_Media // ,Payment_Media_No // ,Payment_Media_Date // ,Bank_Name // ,Bank_Branch // ,RoutingNo // ,BankAccNo // ,Deposit_Withdraw // ,Vouchar_SN // ,Trans_Reason // ,Remarks // ,Entry_Branch_ID // ) // VALUES // ( " // + paymentInfoBo.PaymentId // + ",'" + paymentInfoBo.CustCode // + "'," + paymentInfoBo.Amount // + ",'" + paymentInfoBo.RecievedDate.ToString("MM-dd-yyyy") // + "','" + paymentInfoBo.PaymentMedia // + "','" + paymentInfoBo.PaymentMediaNo // + "','" + paymentInfoBo.PaymentMediaDate.ToString("MM-dd-yyyy") // + "','" + paymentInfoBo.BankName // + "','" + paymentInfoBo.BranchName // + "','" + paymentInfoBo.RoutingNo // + "','" + paymentInfoBo.BankAccNo // + "','" + paymentInfoBo.DepositWithdraw // + "','" + paymentInfoBo.VoucherSlNo // + "','" + paymentInfoBo.TransReason // + "','" + paymentInfoBo.Remarks // + "',CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME)" // +",'"+ GlobalVariableBO._userName // + "','" + paymentInfoBo.BankName // + "','" + paymentInfoBo.BranchName // + "',0,'" // + "'," + GlobalVariableBO._branchId // + ")"; #endregion queryString = @"INSERT INTO [SBP_Database].[dbo].[SBP_Payment_Posting_Request] ( --[Payment_ID] --, [Cust_Code] , [Amount] , [Received_Date] , [Payment_Media] , [Payment_Media_No] , [Payment_Media_Date] , [Bank_ID] , [Bank_Name] , [Branch_ID] , [Bank_Branch] , [RoutingNo] , [BankAccNo] , [Received_By] , [Deposit_Withdraw] , [Payment_Approved_By] , [Payment_Approved_Date] , [Vouchar_SN] , [Trans_Reason] , [Remarks] , [Entry_Date] , [Entry_By] , [Maturity_Days] , [Deposit_Bank_Name] , [Deposit_Branch_Name] , [Approval_Status] , [Rejection_Reason] , [Entry_Branch_ID] ) VALUES (" //+ paymentInfoBo.PaymentId //+ ",'" + "'" + paymentInfoBo.CustCode + "'," + paymentInfoBo.Amount + ",'" + paymentInfoBo.RecievedDate.ToString("MM-dd-yyyy") + "','" + paymentInfoBo.PaymentMedia + "','" + paymentInfoBo.PaymentMediaNo + "','" + paymentInfoBo.PaymentMediaDate.ToString("MM-dd-yyyy") + "'," + paymentInfoBo.Bank_ID + ",'" + paymentInfoBo.BankName + "'," + paymentInfoBo.Branch_ID + ",'" + paymentInfoBo.BranchName + "','" + paymentInfoBo.RoutingNo + "','" + paymentInfoBo.BankAccNo + "','" + paymentInfoBo.RecievedBy + "','" + paymentInfoBo.DepositWithdraw + "','" + paymentInfoBo.PaymentApprovedBy + "'," + ((Convert.ToString(paymentInfoBo.PaymentApprovedDate) == string.Empty) ? "null" : "'" + paymentInfoBo.PaymentApprovedDate.Value.ToString("MM-dd-yyyy") + "'") + ",'" + paymentInfoBo.VoucherSlNo + "','" + paymentInfoBo.TransReason + "','" + paymentInfoBo.Remarks + "',CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME)" + ",'" + GlobalVariableBO._userName + "',0" + ",'" + "" + "','" + "" + "',0" + ",'" + "" + "'" + "," + GlobalVariableBO._branchId + ")"; //} try { _dbConnection.ConnectDatabase(); _dbConnection.ExecuteNonQuery(queryString); } catch (Exception ex) { throw ex; } finally { _dbConnection.CloseDatabase(); } }