public ActionResult EditBatchReg(string degree, string section, string batch, int part, string SubjectRegToPartChange)
        {
            var getAllDegrees = r.Degree_Program.OrderBy(s => s.ProgramID).Select(s => s);
            //var getAllSections = r.Sections.OrderBy(s => s.SectionID).Select(s => s);
            var getAllSubjects = r.Subjects.OrderBy(s => s.SubjectID).Select(s => s);

            if (part != null && (degree != null && degree.ToString() != "Please select") &&
                (section != null && section.ToString() != "Please select") &&
                (batch != null && batch != "Please select"))
            {
                Guid degID = Guid.Parse(degree);
                //Guid Part = Guid.Parse(part);
                Guid secID = Guid.Parse(section);

                string result = BatchModel.UpdateBatch_Subj_PartRec(degID, batch, secID, part);

                var getDegreeName = r.Degree_Program.Where(s => s.ProgramID == degID).Select(s => s.Degree_ProgramName).FirstOrDefault();
                if (result == "OK")
                {
                    ViewBag.Message = "Batch " + batch + "with Degree Program " + getDegreeName + " has changed its part to:" + part + " All the Subjects were Assigned to part " + part;
                    ViewBag.Degrees = getAllDegrees;
                    TempData["S"]   = "1";
                    //ViewBag.Message = "Sucessfully Part Changed";

                    //ViewBag.Sections = getAllSections;
                    ViewBag.Subjects = getAllSubjects;
                    //var getSubjectofBPS = r.Batch_Subjects_Parts.Where(s => s.BatchName == batch && s.Part == Part).Select(s => s);
                    return(View());
                }
                else if (result == "OKNoSub")
                {
                    ViewBag.Message = "Batch " + batch + "with Degree Program " + getDegreeName + " has changed its part to:" + part + ", No Subjects Were Assigned to Part" + part;
                    ViewBag.Degrees = getAllDegrees;
                    TempData["S"]   = "0";
                    //ViewBag.Message = "Sucessfully Part Changed";

                    //ViewBag.Sections = getAllSections;
                    ViewBag.Subjects = getAllSubjects;
                    //var getSubjectofBPS = r.Batch_Subjects_Parts.Where(s => s.BatchName == batch && s.Part == Part).Select(s => s);
                    return(View());
                }
                else
                {
                    ViewBag.Message = result;
                    ViewBag.Degrees = getAllDegrees;
                    //ViewBag.Sections = getAllSections;
                    ViewBag.Subjects = getAllSubjects;
                    TempData["S"]    = "2";
                    return(View());
                }
            }
            else
            {
                ViewBag.Message = "Plz Fill All The Fields";
                ViewBag.Degrees = getAllDegrees;
                //ViewBag.Sections = getAllSections;
                ViewBag.Subjects = getAllSubjects;
                return(View());
            }
        }
    void OnBatchAssignedPickups(object bm)
    {
        BatchModel batchModel = (BatchModel)bm;

        // position obstacles and pickups in the spawnpoints in the batch
        foreach (SpawnPointModel spawnPoint in batchModel.GetSpawnPoints())
        {
            if (spawnPoint.IsSlotTaken())
            {
                if (spawnPoint.GetItem() != null)
                {
                    float yOffset = tensionActive ? 0 : UnityEngine.Random.Range(0, batchModel.GetMaxYoffset());

                    spawnPoint.GetItem().gameObject.transform.position = new Vector3(
                        spawnPoint.gameObject.transform.position.x,
                        spawnPoint.gameObject.transform.position.y + yOffset,
                        spawnPoint.gameObject.transform.position.z
                        );

                    // GPMP
                    // Send the object to the opponent if we are the host
                    if (iAmTheHost)
                    {
                        EventManager.TriggerEvent(GPMPEvents.Types.GPMP_GAME_ITEM_SPAWNED.ToString(), spawnPoint.GetItem().ToBytes());
                    }
                }
            }
        }

        // pass model back to the view for display
        EventManager.TriggerEvent(SpawnSystemEvents.BATCH_READY_FOR_SPAWN, bm);
    }
Exemplo n.º 3
0
        public IEnumerable <FileEntryWrapper> MoveOrCopyBatchCheck(BatchModel batchModel)
        {
            var checkedFiles   = new List <object>();
            var checkedFolders = new List <object>();

            if (batchModel.DestFolderId.ValueKind == System.Text.Json.JsonValueKind.Number)
            {
                (checkedFiles, checkedFolders) = FileStorageService.MoveOrCopyFilesCheck(batchModel.FileIds, batchModel.FolderIds, batchModel.DestFolderId);
            }
            else
            {
                (checkedFiles, checkedFolders) = FileStorageService.MoveOrCopyFilesCheck(batchModel.FileIds, batchModel.FolderIds, batchModel.DestFolderId);
            }

            var entries = FileStorageService.GetItems(checkedFiles.OfType <int>().Select(Convert.ToInt32), checkedFiles.OfType <int>().Select(Convert.ToInt32), FilterType.FilesOnly, false, "", "");

            entries.AddRange(FileStorageService.GetItems(checkedFiles.OfType <string>(), checkedFiles.OfType <string>(), FilterType.FilesOnly, false, "", ""));

            return(entries.Select(r =>
            {
                FileEntryWrapper wrapper = null;
                if (r is Folder <int> fol1)
                {
                    wrapper = FolderWrapperHelper.Get(fol1);
                }
                if (r is Folder <string> fol2)
                {
                    wrapper = FolderWrapperHelper.Get(fol2);
                }

                return wrapper;
            }));
        }
    void OnBatchAssignedObstacles(object bm)
    {
        BatchModel batchModel = (BatchModel)bm;

        // after the batch has obstacles -> pass it to the pickup controller
        EventManager.TriggerEvent(SpawnSystemEvents.ASSIGN_PICKUPS_TO_BATCH, bm);
    }
Exemplo n.º 5
0
        public virtual JsonResult BatchHanlde([FromBody] BatchModel <T> batchModel, [FromServices] IRepositoryBase repository)
        {
            RestResponseDto res = new RestResponseDto();

            var groups = batchModel.Entitys.GroupBy(x => x._state);

            foreach (var group in groups)
            {
                group.ToList().ForEach(model =>
                {
                    ReflectionUtil.TrimString(model);
                    Validate(model);
                });
                switch (group.Key)
                {
                case "added":
                    repository.Insert <T>(group.ToArray());
                    break;

                case "modified":
                    repository.Update <T>(group.ToArray());
                    break;
                }
            }
            res.Success = true;

            return(Json(res));
        }
        public ActionResult AddBatchRecords(Batch BatchRec, string degree, string section, string newBatch, string year)
        {
            try
            {
                var getAllDegrees  = r.Degree_Program.OrderBy(s => s.ProgramID).Select(s => s);
                var getAllSections = r.Sections.OrderBy(s => s.SectionID).Select(s => s);
                var getAllYears    = r.Years.OrderBy(s => s.YearID).Select(s => s);

                string result = BatchModel.AddBatch(BatchRec, degree, section, year);
                if (result == "OK")
                {
                    ViewBag.Degrees  = getAllDegrees;
                    ViewBag.Sections = getAllSections;
                    ViewBag.Years    = getAllYears;
                    ViewBag.Message  = "Successfully Record Added";
                    return(View());
                }
                else
                {
                    ViewBag.Degrees  = getAllDegrees;
                    ViewBag.Sections = getAllSections;
                    ViewBag.Years    = getAllYears;
                    ViewBag.Message  = "Error! " + result;
                    return(View());
                }
            }
            catch (Exception)
            {
                return(RedirectToAction("ViewBatches"));
            }
        }
Exemplo n.º 7
0
        public async Task <IActionResult> BatchDownloadLabel(BatchModel model)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageOrders))
            {
                return(AccessDeniedView());
            }

            var batch = await _easyPostService.GetBatchByIdAsync(model.Id);

            if (batch is not null)
            {
                var((downloadUrl, contentType), error) = await _easyPostService.DownloadBatchLabelAsync(batch);

                if (!string.IsNullOrEmpty(error))
                {
                    var locale = await _localizationService.GetResourceAsync("Plugins.Shipping.EasyPost.Error");

                    _notificationService.ErrorNotification(string.Format(locale, error, Url.Action("List", "Log")), false);
                }
                else
                {
                    //return file
                    var filename = _nopFileProvider.GetFileName(downloadUrl);
                    var client   = _httpClientFactory.CreateClient(NopHttpDefaults.DefaultHttpClient);
                    var stream   = await client.GetStreamAsync(downloadUrl);

                    return(File(stream, contentType, filename, true));
                }
            }

            return(RedirectToAction("BatchEdit", new { id = batch?.Id ?? 0 }));
        }
Exemplo n.º 8
0
        private static List <BatchViewModel> ProcessFile(DataProcessNumbers dpn, int BatchId, string jsonPath)
        {
            BatchModel            btc     = new BatchModel();
            BatchViewModel        bvm     = new BatchViewModel();
            List <BatchViewModel> bvmList = new List <BatchViewModel>();

            var list = JsonConvert.DeserializeObject <List <BatchViewModel> >(File.ReadAllText(jsonPath));

            bvmList = list ?? bvmList;

            var _batchVM = bvmList.FirstOrDefault(item => item.BatchId == BatchId);

            if (_batchVM != null)
            {
                _batchVM.Batches.Add(btc.ConvertToBatch(dpn));
            }
            else
            {
                bvm.BatchId = BatchId;
                bvm.Batches.Add(btc.ConvertToBatch(dpn));
                bvmList.Add(bvm);
            }


            System.IO.File.WriteAllText(jsonPath, JsonConvert.SerializeObject(bvmList));
            return(bvmList);
        }
Exemplo n.º 9
0
        public async Task <IActionResult> BatchGenerateManifest(BatchModel model)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageOrders))
            {
                return(AccessDeniedView());
            }

            var batch = await _easyPostService.GetBatchByIdAsync(model.Id);

            if (batch is null)
            {
                return(RedirectToAction("BatchList"));
            }

            var(_, error) = await _easyPostService.GenerateBatchManifestAsync(batch);

            if (!string.IsNullOrEmpty(error))
            {
                var locale = await _localizationService.GetResourceAsync("Plugins.Shipping.EasyPost.Error");

                _notificationService.ErrorNotification(string.Format(locale, error, Url.Action("List", "Log")), false);
                return(RedirectToAction("BatchList"));
            }

            _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Plugins.Shipping.EasyPost.Success"));

            return(RedirectToAction("BatchEdit", new { id = batch.Id }));
        }
 public ActionResult Index()
 {
     ViewBag.temp = TempData["id"].ToString();
     BatchModel m = BatchModel.Read(int.Parse(TempData["id"].ToString()));
     m.getValues();
     return View(m);
 }
Exemplo n.º 11
0
        public void SetUp()
        {
            var batchRepo               = new Mock <IBatch>();;
            var feedRepo                = new Mock <ITrainerFeedback>();
            var trainerRepo             = new Mock <ITrainer>();
            List <BatchModel> modelList = new List <BatchModel>();

            for (int i = 0; i < 10; i++)
            {
                BatchModel model = new BatchModel();
                model.Id = i;
                modelList.Add(model);
            }
            List <TrainerModel> trainerModelList = new List <TrainerModel>();

            for (int i = 0; i < 10; i++)
            {
                TrainerModel model = new TrainerModel();
                model.Id   = i;
                model.Name = i.ToString();
                trainerModelList.Add(model);
            }
            batchRepo.Setup(r => r.GetAll()).Returns(modelList);
            trainerRepo.Setup(t => t.GetAll()).Returns(trainerModelList);
            _batchRepo           = batchRepo.Object;
            _trainerFeedbackRepo = feedRepo.Object;
            _trainerRepo         = trainerRepo.Object;
        }
        public ActionResult ViewBatches(int?page, int category)
        {
            SessionClearOnReload();
            var getAllBatchRecords = BatchModel.getAllBatches(category);

            return(View("ViewBatches", getAllBatchRecords.ToPagedList(page ?? 1, 10)));
        }
Exemplo n.º 13
0
        public IActionResult Edit(int id, BatchModel productStock)
        {
            //[Bind("ID,Tag,EnrollmentDate")]
            if (id != productStock.BatchId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _batchBll.AddUpdateBatchStock(productStock);
                }
                catch (Exception ex)
                {
                    if (!ProductExists(productStock.BatchId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw ex;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(productStock));
        }
    void OnBatchNewBatchCreated(object bm)
    {
        BatchModel batchModel = (BatchModel)bm;

        // first give batch obstacles by passing the model to the obstacle controller
        EventManager.TriggerEvent(SpawnSystemEvents.ASSIGN_OBSTACLES_TO_BATCH, bm);
    }
Exemplo n.º 15
0
        public async Task <IActionResult> AnalyzeBatch([FromBody] BatchModel dto)
        {
            var db_res = await _service.Create(dto); //dont really want this one to take a long time -> dont really care to much about db integrity

            _det.testBatch(dto);
            Console.WriteLine(db_res);
            return(Ok(RECEIVED_RESPONSE));
        }
Exemplo n.º 16
0
        public ActionResult DeleteConfirmed(int id)
        {
            BatchModel batchModel = db.BatchModels.Find(id);

            db.BatchModels.Remove(batchModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 17
0
        private double getIntervalInSeconds(BatchModel model)
        {
            var first = model.Accelerometer.First().stamp;
            var last  = model.Accelerometer.Last().stamp;
            var span  = last - first;

            return(span.TotalSeconds);
        }
Exemplo n.º 18
0
 public bool Edit(BatchModel batch)
 {
     if (batch != null)
     {
         db.Entry(batch).State = EntityState.Modified;
         return(db.SaveChanges() > 0);
     }
     return(false);
 }
Exemplo n.º 19
0
        private int getNumberOfGyro(BatchModel model)
        {
            var sum = 0;

            foreach (var gyro in model.Gyroscope)
            {
                sum += 1;
            }
            return(sum);
        }
Exemplo n.º 20
0
        /// <inheritdoc cref="Delete(List{int},bool)"/>
        public async Task <ApiBatchResult <bool> > DeleteAsync(List <int> idBatch, bool deleteIfReferenced, CancellationToken cancellationToken = default)
        {
            var batch    = new BatchModel <int>(idBatch);
            var resource = $"{BatchUrl}/{deleteIfReferenced.ToString(CultureInfo.InvariantCulture)}";
            var request  = await CreateRequestAsync(resource, method : Method.DELETE, cancellationToken).ConfigureAwait(false);

            request.AddJsonBody(batch);

            return(await ExecuteBatchAsync <bool>(request, cancellationToken).ConfigureAwait(false));
        }
Exemplo n.º 21
0
        public bool ModifyBatch(int batchId, Status status)
        {
            BatchModel batch = new BatchModel()
            {
                Status   = status,
                Batch_Id = batchId
            };

            return(ModifyBatch(batch));
        }
Exemplo n.º 22
0
        public IEnumerable <FileEntryWrapper> MoveOrCopyBatchCheck(BatchModel batchModel)
        {
            var(checkedFiles, checkedFolders) = FileStorageService.MoveOrCopyFilesCheck(batchModel.FileIds, batchModel.FolderIds, batchModel.DestFolderId);

            var entries = FileStorageService.GetItems(checkedFiles.OfType <int>().Select(Convert.ToInt32), checkedFiles.OfType <int>().Select(Convert.ToInt32), FilterType.FilesOnly, false, "", "");

            entries.AddRange(FileStorageService.GetItems(checkedFiles.OfType <string>(), checkedFiles.OfType <string>(), FilterType.FilesOnly, false, "", ""));

            return(entries.Select(GetFileEntryWrapper));
        }
Exemplo n.º 23
0
 public JsonResult IsBatchName_Unique(BatchModel batch)
 {
     if (batch.Id > 0)
     {
         return(Json(true, JsonRequestBehavior.AllowGet));
     }
     return(IsExist(batch.Name)
     ? Json(true, JsonRequestBehavior.AllowGet)
     : Json(false, JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 24
0
        private int getNumberOfAcc(BatchModel model)
        {
            var sum = 0;

            foreach (var acc in model.Accelerometer)
            {
                sum += 1;
            }
            return(sum);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Deletes entities.
        /// </summary>
        /// <param name="idBatch">List of entity ids.</param>
        /// <param name="deleteIfReferenced">Indicates whether items referenced on invoices or exported items will be deleted.</param>
        /// <returns><see cref="ApiBatchResult{TData}"/> instance.</returns>
        public ApiBatchResult <bool> Delete(List <int> idBatch, bool deleteIfReferenced)
        {
            var batch    = new BatchModel <int>(idBatch);
            var resource = $"{BatchUrl}/{deleteIfReferenced.ToString(CultureInfo.InvariantCulture)}";
            var request  = CreateRequest(resource, Method.DELETE);

            request.AddJsonBody(batch);

            return(ExecuteBatch <bool>(request));
        }
Exemplo n.º 26
0
        public async Task <IActionResult> BatchDraft([FromBody] BatchModel model)
        {
            if (model == null)
            {
                return(this.InvalidRequest());
            }

            await this.PageService.BatchUpdateStatus(model.PageList, PageStatus.Draft);

            return(this.Success());
        }
Exemplo n.º 27
0
        public ActionResult Index()
        {
            //int.TryParse(param, out int id);
            BatchModel         batch = Singleton.Instance.DBManager.RetrieveBatch(1);
            IList <BatchModel> list  = new List <BatchModel>()
            {
                batch
            };

            return(View(list));
        }
Exemplo n.º 28
0
        public async Task <IActionResult> BatchReject([FromBody] BatchModel model)
        {
            if (model == null)
            {
                return(this.InvalidRequest());
            }

            await this.CommentService.BathUpdateStatus(model.CommentList, Core.Enums.CommentStatus.Reject);

            return(this.Success());
        }
Exemplo n.º 29
0
        public async Task <IActionResult> Delete([FromBody] BatchModel model)
        {
            if (model == null)
            {
                return(this.InvalidRequest());
            }

            await this.CommentService.BatchDelete(model.CommentList);

            return(this.Success());
        }
Exemplo n.º 30
0
        public void testBatch(BatchModel batch)
        {
            var interval = (int)getIntervalInSeconds(batch);
            //var data = _stools.extractNext(interval, batch.Accelerometer.Count, batch.Gyroscope.Count);
            var det_res = _det.analyzeBatch(batch);

            if (det_res.IsFallen)
            {
                hubContext.Clients.All.SendAsync("Analysis", det_res);
            }
        }