public ActionResult ScheduleSet(ScheduleSet Task)
        {
            if (ModelState.IsValid)
            {
                TMAppContext db      = new TMAppContext();
                ScheduleSet  newTask = new ScheduleSet();
                newTask.Description = Task.Description;
                newTask.Categories  = Task.Categories;
                newTask.Date        = Task.Date;
                newTask.Location    = Task.Location;
                newTask.Email       = Task.Email;
                //newTask.Username = Task.Username;
                //newTask.Password = Task.Password;
                Task.Status = "Active";

                var CheckUser = db.RegistersTable.Where(m => m.Email.Equals(Task.Email));
                // var CheckUser = db.RegistersTable.Where(m => m.Username.Equals(Task.Username) && m.Password.Equals(Task.Password)).FirstOrDefault();
                if (CheckUser != null)
                {
                    db.ScheduleSetsTable.Add(newTask);
                    db.SaveChanges();

                    TempData["Msg"] = "<script> alert('Task Successfully set');</script>";
                    return(RedirectToAction("ScheduleSetView"));
                }
                else
                {
                    TempData["Errormsg"] = "<script> alert('Email not registered');</script>";
                    return(View("ScheduleSetView"));
                }
            }
            return(View("ScheduleSetView"));
        }
示例#2
0
        public void AddQuickSchedule_EmptyDisplayName_Failure()
        {
            var res = ScheduleSet.AddQuickSchedule(_mockServer, "", "LocationObjectId", "",
                                                   0, 100, true, true, true, true, true, false, false);

            Assert.IsFalse(res.Success, "Calling AddQuickSchedule with empty display name did not fail");
        }
        public void GetScheduleSet_InvalidDisplayName_Failure()
        {
            ScheduleSet oTempSet;
            var         res = ScheduleSet.GetScheduleSet(out oTempSet, _connectionServer, "", "bogus display name");

            Assert.IsFalse(res.Success, "Calling GetScheduleSet with invalid name did not fail.");
        }
示例#4
0
        public void GetSchedulesSetsMembers_NullConnectionServer_Failure()
        {
            List <ScheduleSetMember> oMembers;
            var res = ScheduleSet.GetSchedulesSetsMembers(null, "bogus", out oMembers);

            Assert.IsFalse(res.Success, "Getting schedule set members with null ConnectionServerRest did not fail");
        }
示例#5
0
        public void GetSchedulesSetsMembers_EmptyObjectId_Failure()
        {
            List <ScheduleSetMember> oMembers;
            var res = ScheduleSet.GetSchedulesSetsMembers(_mockServer, "", out oMembers);

            Assert.IsFalse(res.Success, "Getting schedule set members with empty objectId did not fail");
        }
示例#6
0
        public void AddQuickSchedule_EmptyLocationAndSubscriberObjectId_Failure()
        {
            var res = ScheduleSet.AddQuickSchedule(_mockServer, "display name", "", "",
                                                   0, 100, true, true, true, true, true, false, false);

            Assert.IsFalse(res.Success, "Calling AddQuickSchedule with empty locaiton and subscriber ObjectID did not fail");
        }
示例#7
0
        public void AddQuickSchedule_NullConnectionServer_Failure()
        {
            var res = ScheduleSet.AddQuickSchedule(null, "display name", "LocationObjectId", "",
                                                   0, 100, true, true, true, true, true, false, false);

            Assert.IsFalse(res.Success, "Calling AddQuickSchedule with null Connection server did not fail");
        }
示例#8
0
        public void GetScheduleSet_NullConnectionServer_Failure()
        {
            ScheduleSet oTempSet;
            var         res = ScheduleSet.GetScheduleSet(out oTempSet, null, "", "bogus");

            Assert.IsFalse(res.Success, "Calling GetScheduleSet with null ConnecitonServer did not fail.");
        }
示例#9
0
        public void AddScheduleSet_NullConnectionServer_Failure()
        {
            ScheduleSet oSet;
            var         res = ScheduleSet.AddScheduleSet(null, "DisplayName", "locationObjectId", "", out oSet);

            Assert.IsFalse(res.Success, "Calling AddScheduleSet with null ConnectionServerRest did not fail");
        }
        public void GetScheduleSet_InvalidObjectId_Failure()
        {
            ScheduleSet oTempSet;
            var         res = ScheduleSet.GetScheduleSet(out oTempSet, _connectionServer, "objectId");

            Assert.IsFalse(res.Success, "Calling GetScheduleSet with invalid objectID did not fail.");
        }
示例#11
0
        public void AddQuickSchedule_BothLocationAndSubscriberObjectIds_Failure()
        {
            var res = ScheduleSet.AddQuickSchedule(_mockServer, "display name", "LocationObjectId", "bogus",
                                                   0, 100, true, true, true, true, true, false, false);

            Assert.IsFalse(res.Success, "Calling AddQuickSchedule with both a location and subscriberObjectId did not fail");
        }
        public void AddQuickSchedule_InvalidSubscriberObjectId_Failure()
        {
            var res = ScheduleSet.AddQuickSchedule(_connectionServer, "display name", "", "bogus",
                                                   0, 100, true, true, true, true, true, false, false);

            Assert.IsFalse(res.Success, "Calling AddQuickSchedule with invalid subscriberObjectId did not fail");
        }
示例#13
0
        public void GetScheduleSet_EmptyNameAndOBjectId_Failure()
        {
            ScheduleSet oTempSet;

            var res = ScheduleSet.GetScheduleSet(out oTempSet, _mockServer);

            Assert.IsFalse(res.Success, "Calling GetScheduleSet with empty name and ObjectId did not fail.");
        }
        public void GetSchedulesSetsMembers_InvalidObjectId_Failure()
        {
            List <ScheduleSetMember> oMembers;

            var res = ScheduleSet.GetSchedulesSetsMembers(_connectionServer, "ObjectId", out oMembers);

            Assert.IsFalse(res.Success, "Getting schedule set members with invalid objectId did not fail");
        }
示例#15
0
        public void GetSchedulesSets_NullConnectionServer_Failure()
        {
            //get schedule sets
            List <ScheduleSet> oSets;

            WebCallResult res = ScheduleSet.GetSchedulesSets(null, out oSets);

            Assert.IsFalse(res.Success, "Getting schedule sets with null ConnectionServerRest did not fail");
        }
        public new static void MyClassInitialize(TestContext testContext)
        {
            BaseIntegrationTests.MyClassInitialize(testContext);

            WebCallResult res = ScheduleSet.AddQuickSchedule(_connectionServer, "temp_" + Guid.NewGuid().ToString(),
                                                             _connectionServer.PrimaryLocationObjectId, "", 0, 200, true,
                                                             true, true, true, true, false, false);

            Assert.IsTrue(res.Success, "Failed to create new quick schedule:" + res);
            res = ScheduleSet.GetScheduleSet(out _tempScheduleSet, _connectionServer, res.ReturnedObjectId);
            Assert.IsTrue(res.Success, "Failed to find new quick schedule:" + res);
        }
示例#17
0
        public void AddScheduleSetToTenant_Success()
        {
            ScheduleSet oSchedule;
            var         res = ScheduleSet.AddQuickSchedule(_connectionServer, Guid.NewGuid().ToString(),
                                                           _connectionServer.PrimaryLocationObjectId, "", 0, 1020,
                                                           true, true, true, true, true, false, false, DateTime.Now, null,
                                                           out oSchedule);

            Assert.IsTrue(res.Success, "Failed to create schedule for test:" + res);

            res = _tempTenant.AddScheduleSetToTenant(oSchedule.ObjectId);
            Assert.IsTrue(res.Success, "Failed to add schedule to tenant");
        }
        public void ScheduleSetFetchTests()
        {
            List <ScheduleSet> oSets;
            WebCallResult      res = ScheduleSet.GetSchedulesSets(_connectionServer, out oSets);

            Assert.IsTrue(res.Success, "Failed to fetch schedule sets:" + res);
            Assert.IsTrue(oSets.Count > 0, "No schedule sets returned in fetch");

            string strObjectId = "";
            string strName     = "";

            foreach (var oScheduleSet in oSets)
            {
                strObjectId = oScheduleSet.ObjectId;
                strName     = oScheduleSet.DisplayName;
                Console.WriteLine(oScheduleSet.ToString());
                Console.WriteLine(oScheduleSet.DumpAllProps());
                Console.WriteLine(oScheduleSet.GetScheduleState(DateTime.Now));

                Console.WriteLine(oScheduleSet.Schedules().Count);

                res = oScheduleSet.RefetchScheduleSetData();
                Assert.IsTrue(res.Success, "Failed to re-fetch schedule set data:" + res);
            }

            ScheduleSet oNewSet;

            try
            {
                oNewSet = new ScheduleSet(_connectionServer, strObjectId);
                Console.WriteLine(oNewSet);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to fetch schedule set by valid ObjectId:" + ex);
            }

            try
            {
                oNewSet = new ScheduleSet(_connectionServer, "", strName);
                Console.WriteLine(oNewSet);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to fetch schedule set by valid name:" + ex);
            }

            res = ScheduleSet.GetSchedulesSets(_connectionServer, out oSets, 1, 2, "query=(ObjectId is Bogus)");
            Assert.IsTrue(res.Success, "fetching schedule sets with invalid query should not fail:" + res);
            Assert.IsTrue(oSets.Count == 0, "Invalid query string should return an empty schedule list:" + oSets.Count);
        }
示例#19
0
        public void ScheduleSet_Test()
        {
            _errorString = "";
            List <ScheduleSet> oScheduleSets;
            var res = ScheduleSet.GetSchedulesSets(_connectionServer, out oScheduleSets, 1, 2);

            Assert.IsTrue(res.Success & oScheduleSets.Count > 0, "Failed to fetch scheduleset:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);

            //ScheduleSetMember
            List <ScheduleSetMember> oScheduleSetMembers;

            res = ScheduleSet.GetSchedulesSetsMembers(_connectionServer, oScheduleSets[0].ObjectId,
                                                      out oScheduleSetMembers);
            Assert.IsTrue(res.Success & oScheduleSetMembers.Count > 0, "Failed to fetch schedulesetmembers:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);
        }
 private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
 {
     int ticketId;
     int travelTime;
     int trainId;
     DateTime startDate;
     if (String.IsNullOrEmpty(this.TxtEndCityId.Text)
         || String.IsNullOrEmpty(this.TxtStartCityId.Text)
         || String.IsNullOrEmpty(this.TxtStartDate.Text)
         || String.IsNullOrEmpty(this.TxtTicketId.Text)
         || String.IsNullOrEmpty(this.TxtTrainId.Text)
         || String.IsNullOrEmpty(this.TxtTravelTime.Text))
     {
         MessageBox.Show("All fields must be filled");
     }
     else if(int.TryParse(this.TxtTrainId.Text,out trainId)
         && int.TryParse(this.TxtTicketId.Text,out ticketId)
         && int.TryParse(this.TxtTravelTime.Text,out travelTime)
         && DateTime.TryParse(this.TxtStartDate.Text,out startDate))
     {
         CitySet startCity =
             DataAccess.DataAccess.GetAllCities().FirstOrDefault(x => x.Name == this.TxtStartCityId.Text);
         CitySet endCity =
             DataAccess.DataAccess.GetAllCities().FirstOrDefault(x => x.Name == this.TxtEndCityId.Text);
         ScheduleSet newSchedule = new ScheduleSet() {TicketId = ticketId, TrainId = trainId,TravelTime = travelTime, StartCityId = startCity.Id,EndCityId = endCity.Id,StartDate = startDate};
         if (DataAccess.DataAccess.AddTrip(newSchedule))
         {
             this.parent.RefreshScheduleGrid();
             MessageBox.Show("Successfully added a new trip");
             this.Close();
         }
         else
         {
             MessageBox.Show("Something went wrong");
         }
     }
 }
示例#21
0
        public void RemoveStatement(IList <EPStatement> stmt)
        {
            using (_unisolatedServices.EventProcessingRwLock.AcquireWriteLock())
            {
                try
                {
                    long fromTime = _services.SchedulingService.Time;
                    long toTime   = _unisolatedServices.SchedulingService.Time;
                    long delta    = toTime - fromTime;

                    ICollection <String> statementIds = new HashSet <String>();
                    foreach (EPStatement aStmt in stmt)
                    {
                        if (aStmt == null)
                        {
                            throw new EPServiceIsolationException(
                                      "Illegal argument, a null value was provided in the statement list");
                        }

                        var stmtSpi = (EPStatementSPI)aStmt;
                        statementIds.Add(stmtSpi.StatementId);

                        if (aStmt.ServiceIsolated == null)
                        {
                            throw new EPServiceIsolationException("Statement named '" + aStmt.Name +
                                                                  "' is not currently in service isolation");
                        }
                        if (!aStmt.ServiceIsolated.Equals(_isolatedServiceName))
                        {
                            throw new EPServiceIsolationException("Statement named '" + aStmt.Name +
                                                                  "' not in this service isolation but under service isolation '" +
                                                                  aStmt.Name + "'");
                        }
                    }

                    // start txn
                    _unisolatedServices.StatementIsolationService.BeginUnisolatingStatements(
                        _isolatedServiceName,
                        _services.UnitId,
                        stmt);

                    FilterSet   filters   = _services.FilterService.Take(statementIds);
                    ScheduleSet schedules = _services.SchedulingService.Take(statementIds);

                    _unisolatedServices.FilterService.Apply(filters);
                    _unisolatedServices.SchedulingService.Apply(schedules);

                    foreach (EPStatement aStmt in stmt)
                    {
                        var stmtSpi = (EPStatementSPI)aStmt;
                        stmtSpi.StatementContext.FilterService                = _unisolatedServices.FilterService;
                        stmtSpi.StatementContext.SchedulingService            = _unisolatedServices.SchedulingService;
                        stmtSpi.StatementContext.InternalEventEngineRouteDest =
                            _unisolatedServices.InternalEventEngineRouteDest;
                        stmtSpi.StatementContext.ScheduleAdjustmentService.Adjust(delta);
                        _statementNames.Remove(stmtSpi.Name);
                        stmtSpi.ServiceIsolated = null;
                    }

                    // commit txn
                    _unisolatedServices.StatementIsolationService.CommitUnisolatingStatements(
                        _isolatedServiceName, _services.UnitId, stmt);
                }
                catch (EPServiceIsolationException ex)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    _unisolatedServices.StatementIsolationService.RollbackUnisolatingStatements(_isolatedServiceName,
                                                                                                _services.UnitId, stmt);

                    String message = "Unexpected exception taking statements: " + ex.Message;
                    Log.Error(message, ex);
                    throw new EPException(message, ex);
                }
            }
        }
示例#22
0
        public void DeleteScheduleSet_NullConnectionServer_Failure()
        {
            var res = ScheduleSet.DeleteScheduleSet(null, "bogus");

            Assert.IsFalse(res.Success, "Calling DeleteScheduleSet with null ConnectionServerRest did not fail");
        }
示例#23
0
        public void AddScheduleSet_EmptyLocationIdAndSubscriberId_Failure()
        {
            var res = ScheduleSet.AddScheduleSet(_mockServer, "DisplayName", "", "");

            Assert.IsFalse(res.Success, "Calling AddScheduleSet with empty locaitonId and subscriberId did not fail");
        }
示例#24
0
        public void AddScheduleSet_BothLocationAndSubscriberIds_Failure()
        {
            var res = ScheduleSet.AddScheduleSet(_mockServer, "DisplayName", "bogus", "bogus");

            Assert.IsFalse(res.Success, "Calling AddScheduleSet with both a location and owner objectId did not fail");
        }
示例#25
0
        public void Constructor_NullConnectionServer_Failure()
        {
            ScheduleSet oTest = new ScheduleSet(null);

            Console.WriteLine(oTest);
        }
示例#26
0
 public void Apply(ScheduleSet scheduleSet)
 {
     _spi.Apply(scheduleSet);
 }
示例#27
0
        public void AddScheduleSetMember_EmptySchedulesetAndScheduleIds_Failure()
        {
            var res = ScheduleSet.AddScheduleSetMember(_mockServer, "", "");

            Assert.IsFalse(res.Success, "Calling AddScheduleSetMember with empty scheduleset and schedule Ids did not fail");
        }
示例#28
0
        public void AddScheduleSet_EmptyDisplayName_Failure()
        {
            var res = ScheduleSet.AddScheduleSet(_mockServer, "", "locationObjectId", "");

            Assert.IsFalse(res.Success, "Calling AddScheduleSet with empty display name did not fail");
        }
示例#29
0
        public void DeleteScheduleSet_EmptyObjectId_Failure()
        {
            var res = ScheduleSet.DeleteScheduleSet(_mockServer, "");

            Assert.IsFalse(res.Success, "Calling DeleteScheduleSet with empty objectId did not fail");
        }
示例#30
0
        public void AddStatement(EPStatement[] stmt)
        {
            using (_unisolatedServices.EventProcessingRWLock.AcquireWriteLock())
            {
                try
                {
                    long fromTime = _unisolatedServices.SchedulingService.Time;
                    long toTime   = _services.SchedulingService.Time;
                    long delta    = toTime - fromTime;

                    // perform checking
                    ICollection <int> statementIds = new HashSet <int>();
                    foreach (EPStatement aStmt in stmt)
                    {
                        if (aStmt == null)
                        {
                            throw new EPServiceIsolationException(
                                      "Illegal argument, a null value was provided in the statement list");
                        }
                        var stmtSpi = (EPStatementSPI)aStmt;
                        statementIds.Add(stmtSpi.StatementId);

                        if (aStmt.ServiceIsolated != null)
                        {
                            throw new EPServiceIsolationException("Statement named '" + aStmt.Name +
                                                                  "' already in service isolation under '" +
                                                                  stmtSpi.ServiceIsolated + "'");
                        }
                    }

                    // start txn
                    _unisolatedServices.StatementIsolationService.BeginIsolatingStatements(_isolatedServiceName,
                                                                                           _services.UnitId, stmt);

                    FilterSet   filters   = _unisolatedServices.FilterService.Take(statementIds);
                    ScheduleSet schedules = _unisolatedServices.SchedulingService.Take(statementIds);

                    _services.FilterService.Apply(filters);
                    _services.SchedulingService.Apply(schedules);

                    foreach (EPStatement aStmt in stmt)
                    {
                        var stmtSpi = (EPStatementSPI)aStmt;
                        stmtSpi.StatementContext.FilterService                = _services.FilterService;
                        stmtSpi.StatementContext.SchedulingService            = _services.SchedulingService;
                        stmtSpi.StatementContext.InternalEventEngineRouteDest = _isolatedRuntime;
                        stmtSpi.StatementContext.ScheduleAdjustmentService.Adjust(delta);
                        _statementNames.Add(stmtSpi.Name);
                        stmtSpi.ServiceIsolated = _isolatedServiceName;
                    }

                    // commit txn
                    _unisolatedServices.StatementIsolationService.CommitIsolatingStatements(_isolatedServiceName,
                                                                                            _services.UnitId, stmt);
                }
                catch (EPServiceIsolationException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    _unisolatedServices.StatementIsolationService.RollbackIsolatingStatements(_isolatedServiceName,
                                                                                              _services.UnitId, stmt);

                    string message = "Unexpected exception taking statements: " + ex.Message;
                    Log.Error(message, ex);
                    throw new EPException(message, ex);
                }
            }
        }
示例#31
0
        public void AddScheduleSetMember_NullConnectionServer_Failure()
        {
            var res = ScheduleSet.AddScheduleSetMember(null, "bogus", "bogus");

            Assert.IsFalse(res.Success, "Calling AddScheduleSetMember with null ConnectionServerRest did not fail");
        }