public static bool fcnCashLinqRepeatSale(long _lngCTID, long _lngRecordID, decimal _decAmt, string _strPNRefIn, ref string _strReturnedPNRef, ref string _strAuthNumber) { string strCQUserID = ""; string strUserType = ""; string strUserKey = ""; bool blnRes = false; string strCustomQWSUserName = ""; string strCustomQWSPW = ""; string strCustomQMerchantID = ""; strCustomQWSUserName = clsAppSettings.GetAppSettings().strCashLinqCQUser; strCustomQWSPW = clsAppSettings.GetAppSettings().strCashLinqCQPW; strCustomQMerchantID = clsAppSettings.GetAppSettings().strCashLinqCQMerchantID; string strResXML = ""; using (wsCashLinq.CQ wsCLCQ = new global::CTWebMgmt.wsCashLinq.CQ()) { //login to service using (DataSet dsLoginRes = new DataSet()) { strResXML = wsCLCQ.MerchLogin(strCustomQWSUserName, strCustomQWSPW, strCustomQMerchantID); dsLoginRes.ReadXml(new System.IO.MemoryStream(System.Text.Encoding.ASCII.GetBytes(strResXML))); try { strCQUserID = dsLoginRes.Tables[0].Rows[0]["UID"].ToString(); strUserType = dsLoginRes.Tables[0].Rows[0]["UType"].ToString(); strUserKey = dsLoginRes.Tables[0].Rows[0]["UserKey"].ToString(); } catch { strCQUserID = ""; strUserType = ""; strUserKey = ""; } } wsCashLinq.Response wsCLResponse = new global::CTWebMgmt.wsCashLinq.Response(); wsCLResponse = wsCLCQ.RepeatSale(Convert.ToInt64(strCQUserID), Convert.ToByte(strUserType), strUserKey, Convert.ToInt32(_strPNRefIn), _decAmt, DateTime.Now); string strRespMsg = ""; strRespMsg = wsCLResponse.RespMSG; _strReturnedPNRef = wsCLResponse.PNRef; _strAuthNumber = wsCLResponse.AuthCode; if (strRespMsg.ToUpper() != "Approved".ToUpper()) blnRes = false; else blnRes = true; } return blnRes; }
private bool fcnGetCashLinqTrans(DateTime _dteStart, DateTime _dteEnd) { bool blnRes = false; try { string strCQUserID = ""; string strUserType = ""; string strUserKey = ""; //need to be looked up from db string strCustomQWSUserName = clsAppSettings.GetAppSettings().strCashLinqCQUser; string strCustomQWSPW = clsAppSettings.GetAppSettings().strCashLinqCQPW; string strCustomQMerchantID = clsAppSettings.GetAppSettings().strCashLinqCQMerchantID; string strResXML = ""; using (wsCashLinq.CQ wsCLCQ = new global::CTWebMgmt.wsCashLinq.CQ()) { //login to get cquserid using (DataSet dsLoginRes = new DataSet()) { strResXML = wsCLCQ.MerchLogin(strCustomQWSUserName, strCustomQWSPW, strCustomQMerchantID); try { dsLoginRes.ReadXml(new System.IO.MemoryStream(System.Text.Encoding.ASCII.GetBytes(strResXML))); } catch { } try { strCQUserID = dsLoginRes.Tables[0].Rows[0]["UID"].ToString(); strUserType = dsLoginRes.Tables[0].Rows[0]["UType"].ToString(); strUserKey = dsLoginRes.Tables[0].Rows[0]["UserKey"].ToString(); } catch { strCQUserID = ""; strUserType = ""; strUserKey = ""; } } wsCashLinq.Response wsCLResp = new global::CTWebMgmt.wsCashLinq.Response(); string strPageName = ""; string strRes = ""; if (radAllCTTrans.Checked || radUnmatched.Checked || radCTWeb.Checked) { if (clsAppSettings.GetAppSettings().lngCTUserID == 876299671) strPageName = "CTPmtPageAlt_" + clsAppSettings.GetAppSettings().lngCTUserID.ToString(); else strPageName = "CTPmtPage_" + clsAppSettings.GetAppSettings().lngCTUserID.ToString(); strRes = wsCLCQ.GetReconciled(Convert.ToInt64(strCQUserID), Convert.ToByte(strUserType), strUserKey, strPageName, _dteStart, _dteEnd); if (strRes == "Invalid Login") { MessageBox.Show("Invalid CashLinq credentials.\nIn CampTrak select Administration-->Set Defaults to update your CashLinq CustomQ user name and password."); return false; } blnRes = fcnAddCashLinqTrans(strRes, "Web Module"); } if (blnRes || radCTLocal.Checked) { if (clsAppSettings.GetAppSettings().lngCTUserID == 876299671) strPageName = "LocalTranAlt_" + clsAppSettings.GetAppSettings().lngCTUserID.ToString(); else strPageName = "LocalTran_" + clsAppSettings.GetAppSettings().lngCTUserID.ToString(); strRes = wsCLCQ.GetReconciled(Convert.ToInt64(strCQUserID), Convert.ToByte(strUserType), strUserKey, strPageName, _dteStart, _dteEnd); blnRes = fcnAddCashLinqTrans(strRes, "Local App"); } //eliminate matched transactions from data set if needed if (radUnmatched.Checked) { string strSQL = ""; using (OleDbConnection conDB = new OleDbConnection(clsAppSettings.GetAppSettings().strCTConn)) { conDB.Open(); strSQL = "DROP VIEW qryMerchantTransSummary"; using (OleDbCommand cmdDB = new OleDbCommand(strSQL, conDB)) { try { cmdDB.ExecuteNonQuery(); } catch { } strSQL = "DROP VIEW qryMerchantGiftSummary"; cmdDB.CommandText = strSQL; cmdDB.Parameters.Clear(); try { cmdDB.ExecuteNonQuery(); } catch { } strSQL = "CREATE VIEW qryMerchantTransSummary AS " + "SELECT Count(tblTransactions.lngTransactionID) AS CountOflngTransactionID, " + "Sum(tblTransactions.curPayment) AS curTotAmt, " + "Min(tblTransactions.dteDateAdded) AS dteDateAdded, " + "tblTransactions.strPNRef " + "FROM tblTransactions " + "WHERE IIf([tblTransactions].[strPNRef] Is Null, '', [tblTransactions].[strPNRef]) <>'' AND " + "DateDiff('d', #" + _dteStart.ToShortDateString() + "#, [tblTransactions].[dteDateAdded]) >= 0 AND " + "DateDiff('d', [tblTransactions].[dteDateAdded], #" + _dteEnd.ToShortDateString() + "#) >=0 " + "GROUP BY tblTransactions.strPNRef"; cmdDB.CommandText = strSQL; cmdDB.Parameters.Clear(); try { cmdDB.ExecuteNonQuery(); } catch { } strSQL = "CREATE VIEW qryMerchantGiftSummary AS " + "SELECT Count(tblGift.lngGiftID) AS CountOflngGiftID, " + "Sum(tblGift.curAmount) AS curTotAmt, " + "Min(tblGift.dteGiftDate) AS dteGiftDate, " + "tblGift.strPNRef " + "FROM tblGift " + "WHERE DateDiff('d', #" + _dteStart.ToShortDateString() + "#, [tblGift].[dteGiftDate]) >=0 AND " + "DateDiff('d', [tblGift].[dteGiftDate], #" + _dteEnd.ToShortDateString() + "#) >= 0 AND " + "IIf([tblGift].[strPNRef] Is Null, '', [tblGift].[strPNRef]) <> '' " + "GROUP BY tblGift.strPNRef"; cmdDB.CommandText = strSQL; cmdDB.Parameters.Clear(); try { cmdDB.ExecuteNonQuery(); } catch { } strSQL = "DELETE tblMerchantGatewayTrans.* " + "FROM tblMerchantGatewayTrans " + "WHERE tblMerchantGatewayTrans.lngGWTransID In " + "(" + "SELECT tblMerchantGatewayTrans.lngGWTransID " + "FROM (tblMerchantGatewayTrans " + "LEFT JOIN qryMerchantGiftSummary ON (tblMerchantGatewayTrans.strMerchantRef = qryMerchantGiftSummary.strPNRef) AND " + "(tblMerchantGatewayTrans.decAmount = qryMerchantGiftSummary.curTotAmt)) " + "LEFT JOIN qryMerchantTransSummary ON (tblMerchantGatewayTrans.decAmount = qryMerchantTransSummary.curTotAmt) AND " + "(tblMerchantGatewayTrans.strMerchantRef = qryMerchantTransSummary.strPNRef) " + "WHERE qryMerchantGiftSummary.CountOflngGiftID Is Not Null OR " + "qryMerchantTransSummary.CountOflngTransactionID Is Not Null " + ")"; cmdDB.CommandText = strSQL; cmdDB.Parameters.Clear(); try { cmdDB.ExecuteNonQuery(); } catch { } } conDB.Close(); } } } } catch (Exception ex) { blnRes = false; } return blnRes; }
public static void subProcessRefundCashLinqCC(decimal _decAmt, string _strPNRef) { try { Int64 lngTransID = Convert.ToInt64(_strPNRef); decimal decAmt = _decAmt; string strReason = "Reg Cancelled"; string strCQUserID = ""; string strUserType = ""; string strUserKey = ""; //need to be looked up from db string strCustomQWSUserName = clsAppSettings.GetAppSettings().strCashLinqCQUser; string strCustomQWSPW = clsAppSettings.GetAppSettings().strCashLinqCQPW; string strCustomQMerchantID = clsAppSettings.GetAppSettings().strCashLinqCQMerchantID; string strResXML = ""; using (wsCashLinq.CQ wsCLCQ = new global::CTWebMgmt.wsCashLinq.CQ()) { //login to get cquserid using (DataSet dsLoginRes = new DataSet()) { strResXML = wsCLCQ.MerchLogin(strCustomQWSUserName, strCustomQWSPW, strCustomQMerchantID); dsLoginRes.ReadXml(new System.IO.MemoryStream(System.Text.Encoding.ASCII.GetBytes(strResXML))); try { strCQUserID = dsLoginRes.Tables[0].Rows[0]["UID"].ToString(); strUserType = dsLoginRes.Tables[0].Rows[0]["UType"].ToString(); strUserKey = dsLoginRes.Tables[0].Rows[0]["UserKey"].ToString(); } catch { strCQUserID = ""; strUserType = ""; strUserKey = ""; } } wsCashLinq.Response wsCLResp = new global::CTWebMgmt.wsCashLinq.Response(); wsCLResp = wsCLCQ.Refund(Convert.ToInt64(strCQUserID), Convert.ToByte(strUserType), strUserKey, lngTransID, decAmt, strReason); if (wsCLResp.RespMSG.ToUpper() != "Approved".ToUpper()) { System.Windows.Forms.MessageBox.Show("There was an error processing the refund: " + wsCLResp.RespMSG); } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Error: " + ex.Message); } return; }