//#region strDecryptPassword //public static string strDecryptPassword(string strPassword) //{ // //return clsDES.strDecrypt(strPassword); // //return clsDES.strDecrypt(strPassword,); //} //#endregion #region intValidateBOUser public static Int32 intValidateBOUser(System.Web.UI.Page objPage, string strUserId, string strPassword) { Int32 intReturnValue; clsDBEngine objDB = new clsDBEngine(); ///string strDec = strDecryptPassword(strPassword); string strEncPwd = strEncryptAdminPassword(strPassword); objDB.blnParamClear(); objDB.blnParamAdd(ParameterDirection.Input, "@vcUserId", SqlDbType.VarChar, 50, strUserId); objDB.blnParamAdd(ParameterDirection.Input, "@vcPassword", SqlDbType.VarChar, 255, strEncPwd); objDB.blnParamAdd(ParameterDirection.Input, "@vcIPAddress", SqlDbType.VarChar, 20, objPage.Request.UserHostAddress.ToString()); objDB.blnParamAdd(ParameterDirection.Output, "@intBOSessId", SqlDbType.Int, 4, 0); objDB.blnParamAdd(ParameterDirection.Output, "@vcCompanyCode", SqlDbType.VarChar, 10, ""); objDB.blnParamAdd(ParameterDirection.Output, "@vcVenueCode", SqlDbType.VarChar, 10, ""); objDB.blnParamAdd(ParameterDirection.Output, "@vcEventCode", SqlDbType.VarChar, 10, ""); objDB.blnParamAdd(ParameterDirection.Output, "@vcAppCode", SqlDbType.VarChar, 20, ""); intReturnValue = objDB.lngExecuteSP("spBOValidateAdmin"); if (intReturnValue == 0) { blnSetCookie(objPage, "BO_SessId", objDB.objParamValue("@intBOSessId").ToString(), objPage.Request.IsSecureConnection); blnSetCookie(objPage, "BO_CompanyCode", objDB.objParamValue("@vcCompanyCode").ToString(), objPage.Request.IsSecureConnection); blnSetCookie(objPage, "BO_VenueCode", objDB.objParamValue("@vcVenueCode").ToString(), objPage.Request.IsSecureConnection); blnSetCookie(objPage, "BO_EventCode", objDB.objParamValue("@vcEventCode").ToString(), objPage.Request.IsSecureConnection); blnSetCookie(objPage, "BO_AppCode", objDB.objParamValue("@vcAppCode").ToString(), objPage.Request.IsSecureConnection); blnSetCookie(objPage, "BO_UserId", strUserId, objPage.Request.IsSecureConnection); } objDB.blnCloseConnection(); objDB = null; return(intReturnValue); }
static void Main(string[] args) { const string udcErrorMethod = "Main"; bool blnMailFiles = true; string strFileType = "S"; try { long lngimintUpdateStamp = 0; if (clsimintSettlementProcessor.blnGenerateimintSettlementFile(out lngimintUpdateStamp) == true) { clsDBEngine objDB = new clsDBEngine(); string strSQL = "UPDATE tblControl SET Control_intValue = " + lngimintUpdateStamp.ToString() + " WHERE UPPER(Control_strName) = 'IMINTUPDATESTAMP'"; if (objDB.blnExecute(strSQL) == false) { clsLog.blnLogError(udcErrorSource, udcErrorMethod, "Error updating Control Value :: " + lngimintUpdateStamp.ToString(), objDB.strErrorMessage, false); } objDB.blnCloseConnection(); } string strDirectoryPath = System.AppDomain.CurrentDomain.BaseDirectory + "imint\\Settlement\\"; string strRefundDirectoryPath = System.AppDomain.CurrentDomain.BaseDirectory + "imint\\Refund\\"; string strDestinationPath = System.AppDomain.CurrentDomain.BaseDirectory + "imint\\Mail\\"; while (blnMailFiles == true) { DirectoryInfo objDir = new DirectoryInfo(strDirectoryPath); FileInfo[] objFileInfo = objDir.GetFiles(); for (int intCount = 0; intCount < objFileInfo.Length; intCount++) { if (clsimintSettlementProcessor.blnMailimintSettlementFile(objFileInfo[intCount].Name, objFileInfo[intCount].FullName, strFileType) == true) { objFileInfo[intCount].MoveTo(strDestinationPath + objFileInfo[intCount].Name); } } if (strDirectoryPath != strRefundDirectoryPath) { strDirectoryPath = strRefundDirectoryPath; strFileType = "R"; } else { blnMailFiles = false; } objFileInfo = null; objDir = null; } } catch (Exception ex) { clsLog.blnLogError(udcErrorSource, udcErrorMethod, "Error in Generating imintSettlement File", ex.ToString(), false); } }
public static string strBORights(System.Web.UI.Page objPage, string strMenuName) { clsDBEngine objDB = new clsDBEngine(); string strRights = ""; objDB.blnParamClear(); objDB.blnParamAdd(ParameterDirection.Input, "@strUserId", SqlDbType.VarChar, 50, strGetCookie(objPage, "BO_UserId", "")); objDB.blnParamAdd(ParameterDirection.Input, "@strModuleName", SqlDbType.VarChar, 20, strMenuName); objDB.blnParamAdd(ParameterDirection.Output, "@strRights", SqlDbType.VarChar, 10, ""); if (objDB.lngExecuteSP("spBOGetRights") == 0) { strRights = objDB.objParamValue("@strRights").ToString(); } objDB.blnCloseConnection(); return(strRights); }
public static string strGetData(string strArrayName, string strSQL) { clsDBEngine objDB = new clsDBEngine(); string strLine = "", strReturnData = ""; int intLineCount = 0; strLine = "var " + strArrayName + " = new Array();\n"; strReturnData += strLine; if (objDB.blnOpenResultSet(strSQL) == true) { while (objDB.blnResultsMoveNextRow() == true) { strLine = ""; for (int intCount = 0; intCount < objDB.lngResultsNumCols; intCount++) { if (strLine.Length > 0) { strLine += ", "; } string strValue = strConvertForJavaScript(objDB.objResultsValue(intCount).ToString()); strLine += "'" + strValue + "'"; } if (objDB.lngResultsNumCols > 1) { strLine = strArrayName + "[" + intLineCount + "] = new Array(" + strLine + ");\n"; } else { strLine = strArrayName + "[" + intLineCount + "] = " + strLine + ";\n"; } strReturnData += strLine; intLineCount++; } } else { clsLog.blnLogError("clsMisc", "strGetData(" + strArrayName + ")", "SQL Failed : " + strSQL, objDB.strErrorMessage); } objDB.blnCloseConnection(); return(strReturnData); }
public bool blnUserIsAuth(string strUser, string strCompany, string strCinemaID, string strEventCode, string strDebtId) { const string udcErrorMethod = "blnUserIsAuth"; try { Int32 intReturnValue; objDB.blnParamClear(); objDB.blnParamAdd(ParameterDirection.Input, "@strUserId", SqlDbType.VarChar, 50, strUser); objDB.blnParamAdd(ParameterDirection.Input, "@strCompanyCode", SqlDbType.VarChar, 10, strCompany); objDB.blnParamAdd(ParameterDirection.Input, "@strCinemaID", SqlDbType.VarChar, 10, strCinemaID); objDB.blnParamAdd(ParameterDirection.Input, "@strEventCode", SqlDbType.VarChar, 10, strEventCode); objDB.blnParamAdd(ParameterDirection.Input, "@strDebt_Id", SqlDbType.VarChar, 6, strDebtId); objDB.blnParamAdd(ParameterDirection.Output, "@strRights", SqlDbType.VarChar, 20, ""); intReturnValue = objDB.lngExecuteSP("spBOCheckRights"); if (intReturnValue == 0) { string strRights = objDB.objParamValue("@strRights").ToString(); clsLog.blnLogInfo(udcErrorSource, udcErrorMethod, "Checking user is authorised - Sucess, Rights -" + strRights, "User Id = " + strUser + " Company Code = " + strCompany + " Cinema ID = " + strCinemaID + " EventCode = " + strEventCode + " Debt Id = " + strDebtId); return(true); } else { clsLog.blnLogInfo(udcErrorSource, udcErrorMethod, "Checking user is authorised - Fail", "User Id = " + strUser + " Company Code = " + strCompany + " Cinema ID = " + strCinemaID + " EventCode = " + strEventCode + " Debt Id = " + strDebtId); return(false); } } catch (Exception ex) { clsLog.blnLogError(udcErrorSource, udcErrorMethod, "Error in checking user is Authorised.", ex.ToString(), false); return(false); } objDB.blnCloseConnection(); objDB = null; }
public clsUser() { objDB = new clsDBEngine(); }
internal static bool blnGenerateimintSettlementFile(out long lngimintUpdateStamp) { const string udcErrorMethod = "blnGenerateimintSettlementFile"; string udcMerchantId = clsSettings.Get("IMINT", "MerchantId", "90009796"); string udcTerminalId = clsSettings.Get("IMINT", "TerminalId", "64211677"); const string udcActionCode = "EARN"; //const string udcClassificationCode = "CASH_CASH"; const string udcPaymentType = "CASH"; const string udcUnits = "AMOUNT"; const string udcHasSKUActivity = "0"; lngimintUpdateStamp = 0; try { if (System.IO.Directory.Exists(strFolder) == false) { System.IO.Directory.CreateDirectory(strFolder); } } catch (Exception ex) { clsLog.blnLogError(udcErrorSource, udcErrorMethod, "Error creating imint Directory : " + strFolder, ex.ToString()); return(false); } string strFileName = "", strSettlementDate = ""; ArrayList arlSettlement = new ArrayList(); ArrayList arlPaymentId = new ArrayList(); clsDBEngine objDB = new clsDBEngine(); StreamWriter stwSettlement; System.Text.StringBuilder sbrData; string strSQL = "EXECUTE spGetDataForIMINT"; if (objDB.blnOpenResultSet(strSQL) == true) { if (objDB.blnHasRecords == true) { strSettlementDate = DateTime.Now.ToString("ddMMyyyy"); } while (objDB.blnResultsMoveNextRow() == true) { if (objDB.objResultsValue("Trans_MemberType").ToString() == "IMINT") { sbrData = new System.Text.StringBuilder(); sbrData.Append(objDB.objResultsValue("Trans_MemberNo").ToString() + "|"); sbrData.Append("|||"); sbrData.Append(udcMerchantId + "|"); sbrData.Append("|"); sbrData.Append(udcTerminalId + "|"); sbrData.Append("|"); sbrData.Append((objDB.objResultsValue("Trans_lngId").ToString() + "|")); sbrData.Append("||"); sbrData.Append(udcActionCode + "|"); //sbrData.Append(udcClassificationCode + "|"); sbrData.Append(objDB.objResultsValue("Trans_strIMINTEventType").ToString() + "|"); sbrData.Append("||"); sbrData.Append(udcPaymentType + "|"); sbrData.Append(objDB.objResultsValue("Trans_strDate").ToString() + "|"); sbrData.Append("|"); sbrData.Append(float.Parse(objDB.objResultsValue("Trans_mnyTotal").ToString()).ToString("#") + "|"); sbrData.Append(udcUnits + "|"); sbrData.Append("||"); sbrData.Append(udcHasSKUActivity + "|"); sbrData.Append(strSettlementDate + "|"); sbrData.Append((objDB.objResultsValue("Trans_lngId").ToString() + "|")); sbrData.Append("|||"); sbrData.Append((objDB.objResultsValue("Trans_lngId").ToString() + "|")); sbrData.Append("||||||||"); arlSettlement.Add(sbrData); } else if (objDB.objResultsValue("Trans_MemberType").ToString() == "PB_SAM") { //Add Payback Samsung Base points sbrData = new System.Text.StringBuilder(); sbrData.Append(objDB.objResultsValue("Trans_MemberNo").ToString() + "|"); sbrData.Append("|||"); sbrData.Append(udcMerchantId + "|"); sbrData.Append("|"); sbrData.Append(udcTerminalId + "|"); sbrData.Append("|"); sbrData.Append((objDB.objResultsValue("Trans_lngId").ToString() + "|")); sbrData.Append("||"); sbrData.Append(udcActionCode + "|"); sbrData.Append(objDB.objResultsValue("Trans_strIMINTEventType").ToString() + "|"); sbrData.Append("||"); sbrData.Append(udcPaymentType + "|"); sbrData.Append(objDB.objResultsValue("Trans_strDate").ToString() + "|"); sbrData.Append("|"); sbrData.Append(float.Parse(objDB.objResultsValue("Trans_mnyTotal").ToString()).ToString("#") + "|"); sbrData.Append(udcUnits + "|"); sbrData.Append("||"); sbrData.Append(udcHasSKUActivity + "|"); sbrData.Append(strSettlementDate + "|"); sbrData.Append((objDB.objResultsValue("Trans_lngId").ToString() + "_Samsung_base_point|")); sbrData.Append("|||"); sbrData.Append((objDB.objResultsValue("Trans_lngId").ToString() + "|")); sbrData.Append("||||||||"); arlSettlement.Add(sbrData); //Add Payback Samsung 2X points sbrData = new System.Text.StringBuilder(); sbrData.Append(objDB.objResultsValue("Trans_MemberNo").ToString() + "|"); sbrData.Append("|||"); sbrData.Append(udcMerchantId + "|"); sbrData.Append("|"); sbrData.Append(udcTerminalId + "|"); sbrData.Append("|"); sbrData.Append((objDB.objResultsValue("Trans_lngId").ToString() + "|")); sbrData.Append("||"); sbrData.Append(udcActionCode + "|"); //sbrData.Append(udcClassificationCode + "|"); sbrData.Append("BONUS_POINTS|"); sbrData.Append("||"); sbrData.Append(udcPaymentType + "|"); sbrData.Append(objDB.objResultsValue("Trans_strDate").ToString() + "|"); sbrData.Append("|"); sbrData.Append(float.Parse(objDB.objResultsValue("Trans_mnyTotal").ToString()).ToString("#") + "|"); sbrData.Append(udcUnits + "|"); sbrData.Append("||"); sbrData.Append(udcHasSKUActivity + "|"); sbrData.Append(strSettlementDate + "|"); sbrData.Append((objDB.objResultsValue("Trans_lngId").ToString() + "_Samsung_bonus_point|")); sbrData.Append("|||"); sbrData.Append((objDB.objResultsValue("Trans_lngId").ToString() + "|")); sbrData.Append("||||||||"); arlSettlement.Add(sbrData); } } objDB.blnMoveNextResultSet(); objDB.blnResultsMoveNextRow(); lngimintUpdateStamp = long.Parse(objDB.objResultsValue("Trans_intUpdateStamp").ToString()); if (strSettlementDate.Length > 0) { strFileName = strFolder + "ACTIVITY_IMINT_BIGTREE_" + strSettlementDate + ".txt"; } } else { objDB.blnCloseConnection(); clsLog.blnLogError(udcErrorSource, udcErrorMethod, "Error fetching imint Settlement Data from DB", objDB.strErrorMessage); return(false); } objDB.blnCloseConnection(); if (strFileName.Length > 0) { try { stwSettlement = new StreamWriter(strFileName, false); for (int intCount = 0; intCount < arlSettlement.Count; intCount++) { stwSettlement.WriteLine(arlSettlement[intCount].ToString()); } stwSettlement.Close(); stwSettlement = null; } catch (Exception ex) { stwSettlement = null; clsLog.blnLogError(udcErrorSource, udcErrorMethod, "Error creating imint Settlement File", ex.ToString()); return(false); } } return(true); }
public clsBgDataGrid(Page objPage, string strTableName, string strConString) { objDB = new clsDBEngine(strConString); subCreateArray(strTableName); }
public void ProcessRequest(HttpContext context) { string strFileName = Convert.ToString(context.Request.QueryString["filename"]); string strSQL = HttpUtility.UrlDecode(context.Request.QueryString["query"]); clsDBEngine objDB = new clsDBEngine(); objDB.blnOpenDataset(strSQL); DataTable objDT = objDB.dsData.Tables[0]; //FileInfo newFile = new FileInfo(strFileName); using (ExcelPackage package = new ExcelPackage()) { int intRowCount = objDT.Rows.Count; ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Report"); //Load the datatable into the sheet, starting from cell A1. Print the column names on row 1 worksheet.Cells["A1"].LoadFromDataTable(objDT, true, TableStyles.None); var dateColumns = from DataColumn d in objDT.Columns where d.DataType == typeof(DateTime) || d.ColumnName.Contains("Date") select d.Ordinal + 1; foreach (var dc in dateColumns) { worksheet.Cells[2, dc, intRowCount + 1, dc].Style.Numberformat.Format = "d-MMM-yyyy H:m:s"; } ////Format the header for column 1-3 //using (ExcelRange rng = worksheet.Cells["A1:C1"]) //{ // rng.Style.Font.Bold = true; // rng.Style.Fill.PatternType = ExcelFillStyle.Solid; //Set Pattern for the background to Solid // rng.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(79, 129, 189)); //Set color to dark blue // rng.Style.Font.Color.SetColor(Color.White); //} ////Example how to Format Column 1 as numeric //using (ExcelRange col = ws.Cells[2, 1, 2 + tbl.Rows.Count, 1]) //{ // col.Style.Numberformat.Format = "#,##0.00"; // col.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; //} //Write it back to the client context.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; context.Response.AddHeader("content-disposition", "attachment; filename= " + strFileName + ".xlsx"); context.Response.BinaryWrite(package.GetAsByteArray()); } //context.Response.Clear(); //context.Response.Charset = ""; //context.Response.Buffer = true; //context.Response.ContentType = "application/vnd.ms-excel"; //context.Response.AddHeader("content-disposition", "attachment;filename=" + strFileName + ".xlsx"); //System.IO.StringWriter swWriter = new System.IO.StringWriter(); //System.Web.UI.HtmlTextWriter hwHtmlWriter = new System.Web.UI.HtmlTextWriter(swWriter); //System.Web.UI.WebControls.GridView dgData = new System.Web.UI.WebControls.GridView(); //dgData.DataSource = objDB.dsData; //dgData.DataBind(); //dgData.RenderControl(hwHtmlWriter); //context.Response.Write(swWriter.ToString()); //context.Response.Flush(); //context.Response.End(); }
public MongoMap() { objDB = new clsDBEngine(); }
/// <summary> /// Execute the sp and return collection of array the contain companies, cinemas, events and session data for given User /// </summary> /// <param name="strUserLogin"></param> /// <returns></returns> public static string strGetData(string strUserLogin) { clsDBEngine objDB = new clsDBEngine(); string strSQL = "EXEC spForUserData @strUserLogin = '******'"; string strLine = "", strReturnData = ""; int intLineCount = 0; string strArrayName = "arrcompanies"; strLine = "<script type='text/javascript' language='javascript'>"; strLine += "var " + strArrayName + " = new Array();\n"; strReturnData += strLine; if (objDB.blnOpenResultSet(strSQL) == true) { while (objDB.blnResultsMoveNextRow() == true) { strLine = ""; for (int intCount = 0; intCount < objDB.lngResultsNumCols; intCount++) { if (strLine.Length > 0) { strLine += ", "; } string strValue = strConvertForJavaScript(objDB.objResultsValue(intCount).ToString()); strLine += "'" + strValue + "'"; } if (objDB.lngResultsNumCols > 1) { strLine = strArrayName + "[" + intLineCount + "] = new Array(" + strLine + ");\n"; } else { strLine = strArrayName + "[" + intLineCount + "] = " + strLine + ";\n"; } strReturnData += strLine; intLineCount++; } } //For Cinema if (objDB.blnMoveNextResultSet()) { intLineCount = 0; string arrCinema = "arrCinemas"; strReturnData += "var " + arrCinema + " = new Array();\n"; while (objDB.blnResultsMoveNextRow() == true) { strLine = ""; for (int intCount = 0; intCount < objDB.lngResultsNumCols; intCount++) { if (strLine.Length > 0) { strLine += ", "; } string strValue = strConvertForJavaScript(objDB.objResultsValue(intCount).ToString()); strLine += "'" + strValue + "'"; } if (objDB.lngResultsNumCols > 1) { strLine = arrCinema + "[" + intLineCount + "] = new Array(" + strLine + ");\n"; } else { strLine = arrCinema + "[" + intLineCount + "] = " + strLine + ";\n"; } strReturnData += strLine; intLineCount++; } } if (objDB.blnMoveNextResultSet()) { intLineCount = 0; string arrEvents = "arrEvents"; strReturnData += "var " + arrEvents + " = new Array();\n"; while (objDB.blnResultsMoveNextRow() == true) { strLine = ""; for (int intCount = 0; intCount < objDB.lngResultsNumCols; intCount++) { if (strLine.Length > 0) { strLine += ", "; } string strValue = strConvertForJavaScript(objDB.objResultsValue(intCount).ToString()); strLine += "'" + strValue + "'"; } if (objDB.lngResultsNumCols > 1) { strLine = arrEvents + "[" + intLineCount + "] = new Array(" + strLine + ");\n"; } else { strLine = arrEvents + "[" + intLineCount + "] = " + strLine + ";\n"; } strReturnData += strLine; intLineCount++; } } if (objDB.blnMoveNextResultSet()) { intLineCount = 0; string arrSession = "arrSessions"; strReturnData += "var " + arrSession + " = new Array();\n"; while (objDB.blnResultsMoveNextRow() == true) { strLine = ""; for (int intCount = 0; intCount < objDB.lngResultsNumCols; intCount++) { if (strLine.Length > 0) { strLine += ", "; } string strValue = strConvertForJavaScript(objDB.objResultsValue(intCount).ToString()); strLine += "'" + strValue + "'"; } if (objDB.lngResultsNumCols > 1) { strLine = arrSession + "[" + intLineCount + "] = new Array(" + strLine + ");\n"; } else { strLine = arrSession + "[" + intLineCount + "] = " + strLine + ";\n"; } strReturnData += strLine; intLineCount++; } } else { clsLog.blnLogError("clsMisc", "strGetData()", "SQL Failed : " + strSQL, objDB.strErrorMessage); } strReturnData += "</script>"; objDB.blnCloseConnection(); return(strReturnData); }