Example #1
0
        static void Main(string[] args)
        {
            //DoWork(null);
            MyDataAccess.GetAllData();



            SimulatePdfFile();
            ;
            #region --   --
            var    authors = MyDataAccess.GetAuthors();
            string pdfPath = @"C:\Users\Sweet Family\Desktop\PdfFilesPath";

            var dataTable = DataTableHelper.ToDataTable <Author>(authors);
            var dt        = DataTableHelper.LinqToDataTable(authors);


            // -- Create PDF XML --
            PdfRepositoryV1.TestPdfRepositoryV1();

            PdfRepositoryV1.DoWork();

            //TestLinqToDataTable();

            //var peoples = MyDataAccess.GetDataSync();

            var persons = MyDataAccess.GetSingleDataObjectSyncOK();

            //DoWork(dataTable);
            #endregion


            Console.WriteLine("");
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DbConnection connection = ConnectionFactory.GetConnection();
            MyDataAccess dal        = new MyDataAccess(connection);

            dal.GetShipper("Speedy Express");
        }
Example #3
0
        static void Sample1_CompileOnceExecuteMany()
        {
            string text = System.IO.File.ReadAllText("samples/sample1.txt");

            var engine = new Cet.Core.MicroScript.ScriptEngine();

            engine.CodeStream = Cet.Core.MicroScript.Compiler.Compile(text);

            const int N  = 100000;
            var       sw = Stopwatch.StartNew();

            double total = 0;

            for (int i = 0; i < N; i++)
            {
                var xdata = new MyDataAccess();
                xdata.Parameters.Add("a", 1.0 * i);
                xdata.Parameters.Add("b", 2.0 * i);

                RunResult engres = engine.Execute(xdata);
                total += (double)engres.Result;
            }

            sw.Stop();
            Console.WriteLine($"Sample1_CompileOnceExecuteMany: total={total}; ms={sw.ElapsedMilliseconds}; ms/cyc={sw.ElapsedMilliseconds * 1.0 / N}");
            Console.WriteLine();
        }
Example #4
0
        private void BtnRun_Click(object sender, RoutedEventArgs e)
        {
            this.TxtOutput.Text = string.Empty;

            var engine = new ScriptEngine();

            engine.CodeStream = Compiler.Compile(this.TxtInput.Text ?? string.Empty);

            var xdata = new MyDataAccess()
            {
                TxtOutput = this.TxtOutput,
            };

            RunResult engres = engine.Execute(xdata);

            this.TxtOutput.Text += $"Execution complete: {engres.Result}" + Environment.NewLine;
        }
Example #5
0
        static void Fibonacci()
        {
            string text = System.IO.File.ReadAllText("samples/fib.txt");

            var sw = Stopwatch.StartNew();

            var engine = new Cet.Core.MicroScript.ScriptEngine();

            engine.CodeStream = Cet.Core.MicroScript.Compiler.Compile(text);

            var xdata = new MyDataAccess();

            engine.Execute(xdata);

            sw.Stop();
            Console.WriteLine($"Fibonacci: ms={sw.ElapsedMilliseconds}");
            Console.WriteLine();
        }
Example #6
0
        static void Sample3_CompileOnceExecuteMany()
        {
            string text = System.IO.File.ReadAllText("samples/sample3.txt");

            const int N  = 100000;
            var       sw = Stopwatch.StartNew();

            var engine = new Cet.Core.MicroScript.ScriptEngine();

            engine.CodeStream = Cet.Core.MicroScript.Compiler.Compile(text);

            var xdata = new MyDataAccess();

            xdata.Parameters.Add("N", 1.0 * N);

            var total = (double)engine.Execute(xdata).Result;

            sw.Stop();
            Console.WriteLine($"Sample3_CompileOnceExecuteMany: total={total}; ms={sw.ElapsedMilliseconds}; ms/cyc={sw.ElapsedMilliseconds * 1.0 / N}");
            Console.WriteLine();
        }
 public ProductBLL()
 {
     SDBA = new MyDataAccess("DBConnection");
 }
Example #8
0
        private void SendCompletedCallBack(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            try
            {
                LogHandler logHandler     = new LogHandler();
                string     strMailMessage = "";

                strMailMessage = "";
                string messageId = e.UserState.ToString();
                bool   bSent;

                bSent = false;

                System.Net.Mail.SmtpClient smtp = (System.Net.Mail.SmtpClient)sender;

                messageId = messageId.ToLower();

                if (e.Cancelled)
                {
                    strMailMessage = "CANCELED";
                    if (IsLogging)
                    {
                        logHandler.LogWarning("Message Cancelled : " + e.Cancelled + " UPLOAD_RESPONSE.ID= " + messageId.ToString());
                    }
                    bSent = false;

                    if (MyDataAccess != null)
                    {
                        MyDataAccess.Update_Notif_Message_Recipient(messageId, DateTime.MinValue, bSent);
                    }
                }
                if (e.Error != null)
                {
                    strMailMessage = "ERROR";
                    bSent          = false;
                    if (IsLogging)
                    {
                        logHandler.LogWarning("Message  " + " messageId= " + messageId.ToString() + " hasn't been sent; ");
                    }
                    if (e.Error.Message != null)
                    {
                        logHandler.LogWarning("SMTP ERROR Message : " + e.Error.Message + e.Error.StackTrace);
                    }
                    if (e.Error.InnerException != null)
                    {
                        logHandler.LogWarning("SMTP ERROR InnerException: " + e.Error.InnerException.ToString());
                    }

                    if (MyDataAccess != null)
                    {
                        MyDataAccess.Update_Notif_Message_Recipient(messageId, DateTime.MinValue, bSent);
                    }

                    //restart service needed
                    if (_ns != null && _ns.CanStop)
                    {
                        _ns.ExitCode = NotificationService.EXIT_NEED_RESTART;
                        this._ns.Stop();
                        Thread.Sleep(1000);
                        logHandler.LogWarning("Stopping service");
                        //Environment.Exit(55);
                    }
                }
                else
                {
                    strMailMessage = "SENT";
                    if (IsLogging)
                    {
                        logHandler.LogWarning("Message  " + " messageId =" + messageId.ToString() + " has been sent; ");
                    }
                    bSent = true;

                    if (MyDataAccess != null)
                    {
                        MyDataAccess.Update_Notif_Message_Recipient(messageId, DateTime.Now, bSent);
                    }
                }
            }
            catch (System.NullReferenceException ex)
            {
                LogHandler logHandler = new LogHandler();
                logHandler.LogWarning("ERROR in SendCompletedCallBack NullReferenceException " + ex.Message + "\n " + ex.ToString());
            }
            catch (Exception ex)
            {
                LogHandler logHandler = new LogHandler();
                logHandler.LogWarning("ERROR in SendCompletedCallBack " + ex.Message + "\n" + ex.InnerException.ToString());
            }
        }
Example #9
0
 static UserBLL()
 {
     SDBA = new MyDataAccess("DBConnection");
 }
Example #10
0
 public CategoryBLL()
 {
     SDBA = new MyDataAccess("DBConnection");
 }
Example #11
0
 public OrderBLL()
 {
     SDBA = new MyDataAccess("DBConnection");
 }
 public TransactionBLL()
 {
     SDBA = new MyDataAccess("DBConnection");
 }
Example #13
0
 public Card()
 {
     SDBA = new MyDataAccess("DBConnection");
 }