コード例 #1
0
        public StagedTrxDetails GetQRTrxDetails(SingleFieldRequest <string> qrCodeSeqNoReq)
        {
            var task = LogableTask.NewTask("GetQRTrxDetails");

            try
            {
                task.Log(MethodBase.GetCurrentMethod(), TraceLevel.Info, "received request");

                var trxDetails = ServerHelper.GetResponse <StagedTrxDetails>("MobileCash/" + MethodBase.GetCurrentMethod().Name,
                                                                             new SingleFieldRequest <string> {
                    Data = qrCodeSeqNoReq.Data
                }, false);

                if (trxDetails.Success && trxDetails.Data.HasError == false)
                {
                    if (trxDetails.Data.TrxFound)
                    {
                        UserSession.CurrentSession.QRCodeSeqNo = trxDetails.Data.SeqNo;
                    }

                    return(trxDetails.Data);
                }
                else
                {
                    return new StagedTrxDetails
                           {
                               TrxFound = false
                           }
                };
            }
            catch (Exception ex)
            {
                task.Log(MethodBase.GetCurrentMethod(), TraceLevel.Error, ex);
                return(new StagedTrxDetails
                {
                    TrxFound = false
                });
            }

            finally
            { task.EndTask(); }
        }
コード例 #2
0
        public void SetCommonParams(SetCommonParamsReq req)
        {
            LogableTask task = LogableTask.NewTask("SetCommonParams");

            try
            {
                task.Log(MethodBase.GetCurrentMethod(), TraceLevel.Info, "called");
                if (req.SetCustNum)
                {
                    UserSession.CurrentSession.CustNum = req.CustNum;
                }

                if (req.SetPAN)
                {
                    UserSession.CurrentSession.PAN = req.PAN;
                }
            }
            catch (Exception ex)
            {
                task.Log(MethodBase.GetCurrentMethod(), TraceLevel.Error, ex);
            }
            finally { task.EndTask(); }
        }
コード例 #3
0
 public void Closed()
 {
     UserSession.CurrentSession = null;
     LogableTask.LogSingleActivity("SessionController", MethodBase.GetCurrentMethod(), TraceLevel.Info, "Session closed");
 }
コード例 #4
0
        public static void Main(string[] args)
        {
            DebugLog("Starting");
            if (Debugger.IsAttached == false)
            {
                var pathToExe         = Process.GetCurrentProcess().MainModule.FileName;
                var pathToContentRoot = Path.GetDirectoryName(pathToExe);
                Directory.SetCurrentDirectory(pathToContentRoot);
                DebugLog("Set Current Dir as " + pathToContentRoot);
            }

            Program.textLogWriter = new TextLogWriter();
            DebugLog("Creating logs at " + Environment.CurrentDirectory + "\\Logs");

            Program.textLogWriter.InitializeLogWriter(System.Environment.CurrentDirectory + "\\Logs", "ConceptsClient", false, true, true, true);
            LogableTask task = LogableTask.NewTask("Main");

            try
            {
                task.Log(MethodBase.GetCurrentMethod(), System.Diagnostics.TraceLevel.Info, "Starting app");
                appSettings = JsonConvert.DeserializeObject <appSettingsDTO>(System.IO.File.ReadAllText(System.Environment.CurrentDirectory + "\\ConceptsClient.json"));

                appSettings.ServerUrl = string.Format(appSettings.ServerUrl, appSettings.Server);
                if (Program.appSettings.ServerUrl.EndsWith('/') == false && Program.appSettings.ServerUrl.EndsWith('\\') == false)
                {
                    appSettings.ServerUrl += "/";
                }

                //if (appSettings.LogsFolderPath == null || appSettings.LogsFolderPath == "")
                //    appSettings.LogsFolderPath = Startup.hostingEnvironment.ContentRootPath + "\\Logs";

                //textLogWriter.InitializeLogWriter(appSettings.LogsFolderPath, "ConceptsClient", false, true, true, true);


                var builder = CreateWebHostBuilder(args);
                task.Log(MethodBase.GetCurrentMethod(), System.Diagnostics.TraceLevel.Info, "web host builder created");

                builder.UseKestrel().UseIISIntegration();
                task.Log(MethodBase.GetCurrentMethod(), System.Diagnostics.TraceLevel.Info, "going to use URL " + appSettings.LocalUrl);

                //    builder.UseUrls("http://0.0.0.0:82");


                task.Log(MethodBase.GetCurrentMethod(), System.Diagnostics.TraceLevel.Info, "useUrls set");

                //   if (Debugger.IsAttached == false)// that is running as windows service
                //   builder.UseContentRoot(System.Environment.CurrentDirectory);


                task.Log(MethodBase.GetCurrentMethod(), System.Diagnostics.TraceLevel.Info, "Content root set as " + Environment.CurrentDirectory);

                var host = builder.Build();
                task.Log(MethodBase.GetCurrentMethod(), System.Diagnostics.TraceLevel.Info, "Host built now. Run as Service =" + appSettings.RunAsService);

                if (appSettings.RunAsService)
                {
                    task.Log(MethodBase.GetCurrentMethod(), System.Diagnostics.TraceLevel.Info, "Host starting as windows service");
                    task.EndTask();
                    // host.RunAsCustomService();// host.RunAsService();
                }
                else
                {
                    task.Log(MethodBase.GetCurrentMethod(), System.Diagnostics.TraceLevel.Info, "Host starting now as process");
                    task.EndTask();
                    host.Run();
                }
            }
            catch (Exception ex)
            {
                task.Log(MethodBase.GetCurrentMethod(), System.Diagnostics.TraceLevel.Error, ex);
            }
            finally
            {
                if (task.ended == false)
                {
                    task.EndTask();
                }
            }
        }