public static void SaveReport(string DBName, ReportStatus Status)
                {
                    if (Directory.Exists(_dbDirPath))
                    {
                        string _dbConfigFile = String.Format("{0}\\{1}", _dbDirPath, DBName);

                        if (Directory.Exists(_dbConfigFile))
                        {
                            string[] _dbStructure = File.ReadAllLines(String.Format("{0}\\scheduled_configuration.xs8db", _dbConfigFile));

                            if (Status == ReportStatus.SUCCESS)
                            {
                                _dbStructure[2] = Global.Encrypt(String.Format("[{0}] - Success", DateTime.Now));
                            }
                            else
                            if (Status == ReportStatus.FAIL)
                            {
                                _dbStructure[2] = Global.Encrypt(String.Format("[{0}] - Fail", DateTime.Now));
                            }
                            else
                            if (Status == ReportStatus.QUERYING)
                            {
                                _dbStructure[2] = Global.Encrypt(String.Format("[{0}] - Querying...", DateTime.Now));
                            }
                            else
                            {
                                _dbStructure[2] = Global.Encrypt(String.Format("[{0}] - Can't connect to the DB", DateTime.Now));
                            }

                            File.WriteAllLines(String.Format("{0}\\scheduled_configuration.xs8db", _dbConfigFile), _dbStructure);
                        }
                        else
                        {
                            MessageBox.Show(String.Format(
                                                "Unable to save the 'Report Status' because the '{0}\\{1}' folder is missing!\n\n" +
                                                "[INFORMATIONS]\n" +
                                                "DB Name:       {1}\n" +
                                                "Report Status: {2}\n" +
                                                "Date Time:     {3}",
                                                MainConfigDirectory, DBName, Status.ToString(), DateTime.Now),
                                            "Database Query Scheduler [WARNING]",
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Warning);
                        }
                    }
                    else
                    {
                        MessageBox.Show(String.Format(
                                            "Unable to save the 'Report Status' because the '{0}' folder is missing!\n\n" +
                                            "[INFORMATIONS]\n" +
                                            "DB Name:       {1}\n" +
                                            "Report Status: {2}\n" +
                                            "Date Time:     {3}",
                                            MainConfigDirectory, DBName, Status.ToString(), DateTime.Now),
                                        "Database Query Scheduler [WARNING]",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Warning);
                    }
                }
        public void ActionOnReport(int? expenseId, Employee employee,ReportStatus status)
        {
            //IEmployeeService employeeService = new EmployeeService();
            //Employee employee = employeeService.GetEmployee((int)Membership.GetUser().ProviderUserKey);
            using (EMEntitiesContext ctx = new EMEntitiesContext())
            {

                var report = (from ExpReport in ctx.ExpenseReports
                              where ExpReport.ExpenseId == expenseId
                              select ExpReport).FirstOrDefault();

                //if (action == "Approve")
                //{
                    report.ApprovedDate = DateTime.Now;
                    //report.Status = "ApprovedBySupervisor";
                    report.Status = status.ToString();
                    report.ApprovedById = employee.UserId;
                    ctx.SaveChanges();
                //}
                //else
                //{
                //    report.ApprovedDate = DateTime.Now;
                //    report.Status = "RejectedBySupervisor";
                //    report.ApprovedById = employee.UserId;
                //    ctx.SaveChanges();
                //}
            }
        }
Esempio n. 3
0
        public Task SetStatus(string address, ReportStatus status)
        {
            return(_storage.ReplaceAsync(BaseReportMetadataEntity.GeneratePartitionKey(),
                                         BaseReportMetadataEntity.GenerateRowKey(address),
                                         p =>
            {
                p.Status = status.ToString();

                return p;
            }));
        }
Esempio n. 4
0
        // <summary>
        // Creates an instance of GeoCoordinateWatcherInternal with the specified desired accuracy
        // </summary>
        public GeoCoordinateWatcherInternal(GeoPositionAccuracy desiredAccuracy)
        {
            //
            // Create the native location object on a worker thread, so that it exists
            // in a multithreaded apartment.
            //
            ThreadPool.QueueUserWorkItem(new WaitCallback(this.CreateHandler), desiredAccuracy);

            Utility.Trace("GeoCoordinateWatcherInternal.ctor:" +
                          " desiredAccuracy: " + desiredAccuracy.ToString() +
                          " m_latLongRegistered: " + m_latLongRegistered.ToString() +
                          " m_civicAddrRegistered: " + m_civicAddrRegistered.ToString() +
                          " m_latLongStatus: " + m_latLongStatus.ToString() +
                          " m_curStatus: " + m_curStatus.ToString());
        }
        // <summary>
        // Creates an instance of GeoLocationProviderInternal with the specified desired accuracy
        // </summary>
        public GeoLocationProviderInternal(GeoLocationAccuracy desiredAccuracy)
        {
            //
            // Create the native location object on a worker thread, so that it exists
            // in a multithreaded apartment.
            //
            m_eventCreateDone = new ManualResetEvent(false);

            ThreadPool.QueueUserWorkItem(new WaitCallback(this.CreateHandler), desiredAccuracy);
#if _DEBUG
            m_eventCreateDone.WaitOne(5000);
#else
            m_eventCreateDone.WaitOne(500);
#endif
            Utility.Trace("GeoLocationProviderInternal.ctor: " +
                          "desiredAccuracy: " + desiredAccuracy.ToString() +
                          " m_latLongRegistered: " + m_latLongRegistered.ToString() +
                          " m_civicAddrRegistered: " + m_civicAddrRegistered.ToString() +
                          " m_latLongStatus: " + m_latLongStatus.ToString() +
                          " m_curStatus: " + m_curStatus.ToString());
        }
        public void ProcessReport(int? expenseId, Employee employee, ReportStatus status)
        {
            using (EMEntitiesContext ctx = new EMEntitiesContext())
            {
                var report = (from ExpReport in ctx.ExpenseReports
                              where ExpReport.ExpenseId == expenseId
                              select ExpReport).FirstOrDefault();

                report.ProcessedDate = DateTime.Now;

                report.Status = status.ToString();
                report.ProcessedById = employee.UserId;
                ctx.SaveChanges();

            }
        }