public void Insert(CheckRequisitionBO checkRequisitionBo)//New Requisition { string queryString = ""; string queryWebDataDelete = ""; CommonBAL commonBal = new CommonBAL(); Web2014DataForwardBAL webBal = new Web2014DataForwardBAL(); //checkRequisitionBo.SlNo = commonBal.GenerateID("SBP_Check_Requisition", "Sl_No"); queryString = "INSERT INTO SBP_Check_Requisition(Cust_code,Amount,Requisition_Date,Collection_Branch_ID,Remarks,Is_Approved,Entry_Date,Entry_By,Entry_Branch_ID,OnlineOrderNo,OnlineEntry_Date)" + " VALUES('" + checkRequisitionBo.CustCode + "'," + Convert.ToString(checkRequisitionBo.Amount) + ",'" + checkRequisitionBo.RequisitionDate.ToShortDateString() + "'," + checkRequisitionBo.BranchId + ",'" + checkRequisitionBo.Remarks + "',0,GETDATE(),'" + GlobalVariableBO._userName + "'," + GlobalVariableBO._branchId + "," + checkRequisitionBo.OnlineOrderNo + ",'" + Convert.ToString(checkRequisitionBo.OnlineEntry_Date.Date.Equals(DateTime.MinValue.Date) ? string.Empty : checkRequisitionBo.OnlineEntry_Date.ToString("MM-dd-yyyy")) + "')"; if (checkRequisitionBo.OnlineOrderNo != 0 && checkRequisitionBo.OnlineOrderNo != null) { queryWebDataDelete = webBal.DeleteFrom_Web2014_WithdrawalRequest_Temp(checkRequisitionBo.OnlineOrderNo); } try { _dbConnection.ConnectDatabase(); _dbConnection.StartTransaction(); _dbConnection.ExecuteNonQuery(queryString); if (checkRequisitionBo.OnlineOrderNo != 0 && checkRequisitionBo.OnlineOrderNo != null) { _dbConnection.ExecuteNonQuery(queryWebDataDelete); } _dbConnection.Commit(); } catch (Exception exp) { _dbConnection.Rollback(); throw exp; } 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(); } }