Exemplo n.º 1
0
        public ActionResult Assign_Click(string securityCode)
        {
            AssignViewModel assignViewModel;
            DoctorContainer doctorContainer = new DoctorContainer();
            AssignModel     assignModel     = doctorContainer.CallCheckingSecurityCodeMatch(securityCode);

            if (!assignModel.SecurityCodeMatch)
            {
                assignViewModel = new AssignViewModel
                {
                    SecurityCodeMatch = assignModel.SecurityCodeMatch,
                    AssignMessage     = Resource.AssignSecurityCodeError
                };
                return(View("Assign", assignViewModel));
            }
            else
            {
                assignViewModel = new AssignViewModel
                {
                    patientViewModel = new PatientViewModel {
                        UserId = assignModel.patientModel.Id
                    },
                    SecurityCodeMatch = assignModel.SecurityCodeMatch
                };
                string idD = User.FindFirstValue(ClaimTypes.NameIdentifier);
                assignViewModel.ExistingRelation = doctorContainer.CallCheckRelationDoctorPatient(idD, assignViewModel.patientViewModel.UserId);
                if (assignViewModel.ExistingRelation)
                {
                    assignViewModel.AssignMessage = Resource.AssignExistingRelation;
                    return(View("Assign", assignViewModel));
                }
                else
                {
                    doctorContainer.UseAddPatientToDoctor(idD, assignViewModel.patientViewModel.UserId);
                    assignViewModel.AssignMessage = Resource.AssignSuccess;
                    return(View("Assign", assignViewModel));
                }
            }
        }
        public ActionResult AssignDcName(AssignViewModel avm, string dcButton)
        {
            int parsedPid;

            if (avm.NewDcResource == null)
            {
                TempData["Message"] = "No PID supplied";
            }
            else if (!int.TryParse(avm.NewDcResource, out parsedPid))
            {
                TempData["Message"] = "PID must be a number";
            }
            else
            {
                var fullDoc = GetNameDocByUuid(avm.Doc._id);
                if (fullDoc.dcName == null)
                {
                    fullDoc.dcName = new List <DcEntry>();
                }

                var entry = new DcEntry {
                    type = dcButton, uri = ConfigurationManager.AppSettings["DigitalCollectionsUrl"] + avm.NewDcResource
                };

                if (avm.RelatorLabel != null && avm.RelatorUri != null)
                {
                    entry.relator_uri   = avm.RelatorUri;
                    entry.relator_label = avm.RelatorLabel;
                }

                fullDoc.dcName.Add(entry);

                SaveNameDoc(fullDoc);
                TempData["Message"] = "Resource Added";
            }

            return(RedirectToAction("Name", new { id = avm.Doc._id }));
        }
Exemplo n.º 3
0
        public bool AddAssign(AssignViewModel assignviewmodel)
        {
            string empname          = "";
            int    count            = 0;
            string connectionString = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                SqlCommand cmd1 = new SqlCommand("select * from EmployeeDetails where Employee_ID = '" + assignviewmodel.Emp_Id + "'", con);
                SqlCommand cmd  = new SqlCommand("update warehouse set Status= 'Assigned' where Device_ID= '" + assignviewmodel.Device_Id + "'", con);

                con.Open();
                using (SqlDataReader reader = cmd1.ExecuteReader())
                {
                    if (reader.Read())
                    {
                        count++;
                        empname = reader["Emp_Name"].ToString().Replace(" ", String.Empty);
                    }
                }
                SqlCommand cmd2 = new SqlCommand("insert into History values('" + assignviewmodel.Device_Id + "','" + assignviewmodel.Emp_Id + "','" + empname + "',GETDATE(),'01/01/1950')", con);
                if (count == 1)
                {
                    cmd.ExecuteNonQuery();
                    cmd2.ExecuteNonQuery();
                    Assign assign = new Assign();
                    assign.Emp_Id    = assignviewmodel.Emp_Id;
                    assign.Device_Id = assignviewmodel.Device_Id;
                    employeecontext.Assigns.Add(assign);
                    employeecontext.SaveChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Assign([Bind(Include = "ID,Name,EmployeeID")] AssignViewModel assignedItem)
        {
            try
            {
                if (assignedItem.EmployeeID == null)
                {
                    return(RedirectToAction("Assign", new { ID = assignedItem.ID }));
                }
                if (ModelState.IsValid)
                {
                    Guid itemID     = assignedItem.ID;
                    Guid?employeeID = assignedItem.EmployeeID;
                    await Service.AssignItemAsync(itemID, employeeID);

                    return(RedirectToAction("OnStock"));
                }
            }
            catch (DataException)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again and if the problem persists see your system administrator.");
            }
            return(RedirectToAction("Assign", new { ID = assignedItem.ID }));
        }
Exemplo n.º 5
0
        public ActionResult Index()
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var user     = _systemService.GetUserAndRole(0, userName);

            if (user == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            if (user.StockOutR == 0)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var model = new AssignViewModel
            {
                UserLogin  = user,
                Stores     = new SelectList(_systemService.StoreList(), "Id", "Name"),
                StockTypes = new SelectList(_systemService.TypeStockList(), "Id", "Name"),
                Projects   = new SelectList(_systemService.ProjectList(), "Id", "vProjectID")
            };

            return(View(model));
        }
Exemplo n.º 6
0
        public ActionResult Assign(AssignViewModel model)
        {
            var mentee = model.Mentee;

            mentee = _mentee.GetMentee(mentee.UserId);
            var mentor = model.Mentor;

            var mentors = _mentor.GetMentorsByCategory(mentee.Category);

            ViewBag.UserId = new SelectList(mentors, "UserId", "User.Name", model.Mentor.UserId);


            try
            {
                _mentee.AssignMentor(mentee, mentor.UserId);
                return(RedirectToAction("notmentored"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("invalid", ex.Message);
            }
            return(View(model));
        }
        private void button3_Click_1(object sender, EventArgs e)
        {
            assignedUser();
            AssignViewModel assign = new AssignViewModel
            {
                AssignBy    = Login.userId,
                AssignTo    = id,
                Description = textBox3.Text,
                BugId       = Program.bugId
            };

            AssignDAO assignDAO = new AssignDAO();

            try
            {
                assignDAO.Insert(assign);
                MessageBox.Show("Task assigned");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 8
0
        public ActionResult Create(int? id)
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var user = _systemService.GetUserAndRole(0, userName);
            if (user == null)
            {
                return RedirectToAction("Index", "Login");
            }

            if (user.StockOutR == 0)
            {
                return RedirectToAction("Index", "Home");
            }

            var model = new AssignViewModel
            {
                UserLogin = user,
                Stores = new SelectList(_systemService.StoreList(), "Id", "Name"),
                Projects = new SelectList(_systemService.ProjectList(), "Id", "vProjectID"),
                ProjectNames = new SelectList(_systemService.ProjectList(), "Id", "vProjectName")
            };

            return View(model);
        }
Exemplo n.º 9
0
        public void And_Provider_Adding_Apprentices_Then_Redirect_To_Message(
            AssignViewModel viewModel,
            CohortController controller)
        {
            var expectedRouteValues = new RouteValueDictionary(new
            {
                viewModel.AccountHashedId,
                viewModel.AccountLegalEntityHashedId,
                viewModel.ReservationId,
                viewModel.StartMonthYear,
                viewModel.CourseCode,
                viewModel.ProviderId,
                viewModel.TransferSenderId,
                Origin = viewModel.ReservationId.HasValue ? Origin.Reservations : Origin.Apprentices
            });

            viewModel.WhoIsAddingApprentices = WhoIsAddingApprentices.Provider;

            var result = controller.Assign(viewModel) as RedirectToActionResult;

            result.Should().NotBeNull();
            result.ActionName.Should().Be("Message");
            result.RouteValues.Should().BeEquivalentTo(expectedRouteValues);
        }
Exemplo n.º 10
0
        public ActionResult LoadDataList(int page, int size, int store, int project, int stockType, string stockCode, string stockName, string siv, string fd, string td, string enable)
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var totalRecord = _service.ListConditionCount(page, size, store, project, stockType, stockCode, stockName, siv, fd, td, enable);
            var totalTemp = Convert.ToDecimal(totalRecord) / Convert.ToDecimal(size);
            var totalPages = Convert.ToInt32(Math.Ceiling(totalTemp));
            var model = new AssignViewModel
            {
                UserLogin = _systemService.GetUserAndRole(0, userName),
                AssignStockList = _service.ListCondition(page, size, store, project, stockType, stockCode, stockName, siv, fd, td, enable),
                TotalRecords = Convert.ToInt32(totalRecord),
                TotalPages = totalPages,
                CurrentPage = page,
                PageSize = size
            };

            return PartialView("_StockOutPartial", model);
        }
Exemplo n.º 11
0
        public async Task <IActionResult> Assign(AssignViewModel assignViewModel, string ApplyFilters, string Update)
        {
            if (ModelState.IsValid)
            {
                AssignViewModel newAssignVM = new AssignViewModel();
                newAssignVM.FilterGrade      = assignViewModel.FilterGrade;
                newAssignVM.FilterName       = assignViewModel.FilterName;
                newAssignVM.AssignmentOption = assignViewModel.AssignmentOption;
                newAssignVM.SessionOption    = assignViewModel.SessionOption;

                //Get the possible class assignments
                await GetPossibleClassrooms(newAssignVM);

                //The user selected to apply filter children
                if (!string.IsNullOrWhiteSpace(ApplyFilters))
                {
                    //Get the children
                    await GetChildrenForAssignment(newAssignVM);

                    return(View(newAssignVM));
                }

                //The user has made updates on the form and is now saving the changes
                if (!string.IsNullOrWhiteSpace(Update))
                {
                    //foreach(AssignChild child in assignViewModel.Children)
                    foreach (ClassAssignment assignment in assignViewModel.Assignments)
                    {
                        if (assignment.CurrentClassId != assignment.NewClassId)
                        {
                            var dbChild = await _context.Children
                                          .Where(c => c.Id == assignment.ChildId && c.VBSId == this.CurrentVBSId && c.VBS.TenantId == this.TenantId)
                                          .SingleOrDefaultAsync();

                            if (assignment.NewClassId == 0)
                            {
                                dbChild.ClassroomId = null;
                            }
                            else
                            {
                                dbChild.ClassroomId = assignment.NewClassId;
                            }

                            _context.Children.Update(dbChild);
                            await _context.SaveChangesAsync();
                        }
                    }

                    //Get the children
                    await GetChildrenForAssignment(newAssignVM);

                    return(View(newAssignVM));
                }

                //Get the children
                await GetChildrenForAssignment(newAssignVM);

                return(View(newAssignVM));
            }

            return(View(assignViewModel));
        }
Exemplo n.º 12
0
        public ActionResult LoadDataDetailList(int id, string enable)
        {
            var detailList = _service.ListConditionDetail(id, enable);
            var model = new AssignViewModel
            {
                StockAssignDetailList = detailList,
                TotalRecords = detailList.Count()
            };

            return PartialView("_StockOutDetailPartial", model);
        }
Exemplo n.º 13
0
        private async Task GetChildrenForAssignment(AssignViewModel model)
        {
            //TODO: Use automapper
            var applicationDbContext = _context.Children.Include(c => c.Classroom)
                                       .Include(c => c.Session)
                                       .Where(c => c.VBSId == this.CurrentVBSId && c.VBS.TenantId == this.TenantId);


            applicationDbContext = applicationDbContext.Where(c => c.Session.Period == model.SessionOption);

            if (model.AssignmentOption != Enums.AssignmentOptions.All)
            {
                if (model.AssignmentOption == Enums.AssignmentOptions.Assigned)
                {
                    applicationDbContext = applicationDbContext.Where(c => c.ClassroomId > 0);
                }
                else
                {
                    applicationDbContext = applicationDbContext.Where(c => c.ClassroomId == 0 || c.ClassroomId == null);
                }
            }

            if (model.FilterGrade != Enums.ClassGradeOptions.All)
            {
                applicationDbContext = applicationDbContext.Where(c => (int)c.GradeCompleted == (int)model.FilterGrade);
            }

            if (!string.IsNullOrWhiteSpace(model.FilterName))
            {
                applicationDbContext = applicationDbContext.Where(c => c.FirstName.ToLower().Contains(model.FilterName.ToLower()) ||
                                                                  c.LastName.ToLower().Contains(model.FilterName.ToLower()));
            }

            applicationDbContext = applicationDbContext.OrderBy(c => c.Id);

            List <Child> dbChildren = await applicationDbContext.ToListAsync();

            List <AssignChild>     assignChildren   = new List <AssignChild>();
            List <ClassAssignment> classAssignments = new List <ClassAssignment>();

            foreach (Child dbChild in dbChildren)
            {
                ClassAssignment classAssignment = new ClassAssignment();
                classAssignment.ChildId        = dbChild.Id;
                classAssignment.CurrentClassId = (dbChild.ClassroomId.HasValue) ? dbChild.ClassroomId : 0;
                classAssignment.NewClassId     = (dbChild.ClassroomId.HasValue) ? dbChild.ClassroomId : 0;
                classAssignments.Add(classAssignment);

                AssignChild assignChild = new AssignChild();
                if (dbChild.Classroom != null)
                {
                    assignChild.CurrentClassName = dbChild.Session.Period + " " + dbChild.Classroom.Grade.GetDisplayName() + " " + dbChild.Classroom.Name;
                }
                else
                {
                    assignChild.CurrentClassName = "None";
                }
                assignChild.DateOfBirth           = dbChild.DateOfBirth;
                assignChild.GradeCompleted        = dbChild.GradeCompleted;
                assignChild.Id                    = dbChild.Id;
                assignChild.Name                  = dbChild.FirstName + " " + dbChild.LastName;
                assignChild.PlaceChildWithRequest = dbChild.PlaceChildWithRequest;
                assignChild.HealthConcernsMarkup  = string.Empty;
                if (!string.IsNullOrWhiteSpace(dbChild.AllergiesDescription))
                {
                    assignChild.HealthConcernsMarkup = "<div style='text-align:left'><b>Allergies:</b><br/>" + dbChild.AllergiesDescription;
                }

                if (!string.IsNullOrWhiteSpace(dbChild.MedicalConditionDescription))
                {
                    if (!string.IsNullOrWhiteSpace(assignChild.HealthConcernsMarkup))
                    {
                        assignChild.HealthConcernsMarkup += "<br/><br/>";
                    }
                    else
                    {
                        assignChild.HealthConcernsMarkup += "<div style='text-align:left'>";
                    }

                    assignChild.HealthConcernsMarkup += "<b>Medical Conditions:</b><br/>" + dbChild.MedicalConditionDescription;
                }

                if (!string.IsNullOrWhiteSpace(assignChild.HealthConcernsMarkup))
                {
                    assignChild.HealthConcernsMarkup += "</div>";
                }

                assignChild.Session        = dbChild.Session;
                assignChild.GuardianName   = dbChild.GuardianFirstName + " " + dbChild.GuardianLastName;
                assignChild.CurrentClassId = (int)((dbChild.ClassroomId.HasValue) ? dbChild.ClassroomId : 0);
                assignChild.NewClassId     = (int)((dbChild.ClassroomId.HasValue) ? dbChild.ClassroomId : 0); assignChildren.Add(assignChild);
            }

            model.Children    = assignChildren;
            model.Assignments = classAssignments;
        }
        public ActionResult AssignSubjectAsResource(AssignViewModel avm, string asButton)
        {
            asButton = Regex.Replace(asButton, @" \(...\)", "");
            var resources = AsRepo.GetArchivesSpaceResources();
            var found     = resources.FirstOrDefault(x => x.title + $" ({x.ead_id})" == avm.NewAsResource);

            if (found == null)
            {
                TempData["Message"] = "Resource Not Found";
            }
            else
            {
                var fullDoc = GetSubjectDocByUuid(avm.Doc._id);
                if (asButton == "Assign")
                {
                    if (fullDoc.archivesSpaceRelations == null)
                    {
                        fullDoc.archivesSpaceRelations = new List <string>();
                    }
                    fullDoc.archivesSpaceRelations.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                }
                //if (asButton == "Topic")
                //{
                //    if (fullDoc.topic == null) { fullDoc.topic = new List<string>(); }
                //    fullDoc.topic.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "Geographic")
                //{
                //    if (fullDoc.geographic == null) { fullDoc.geographic = new List<string>(); }
                //    fullDoc.geographic.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "PersonalName")
                //{
                //    if (fullDoc.personalNameSubject == null) { fullDoc.personalNameSubject = new List<string>(); }
                //    fullDoc.personalNameSubject.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "FamilyName")
                //{
                //    if (fullDoc.familyNameSubject == null) { fullDoc.familyNameSubject = new List<string>(); }
                //    fullDoc.familyNameSubject.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "CorporateName")
                //{
                //    if (fullDoc.corporateNameSubject == null) { fullDoc.corporateNameSubject = new List<string>(); }
                //    fullDoc.corporateNameSubject.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "MeetingName")
                //{
                //    if (fullDoc.meeting == null) { fullDoc.meeting = new List<string>(); }
                //    fullDoc.meeting.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "UniformTitle")
                //{
                //    if (fullDoc.uniformTitle == null) { fullDoc.uniformTitle = new List<string>(); }
                //    fullDoc.uniformTitle.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}

                SaveSubjectDoc(fullDoc);
                TempData["Message"] = "Resource Added";
            }

            return(RedirectToAction("Subject", new { id = avm.Doc._id }));
        }
        public ActionResult AssignNameAsResource(AssignViewModel avm, string asButton)
        {
            asButton = Regex.Replace(asButton, @" \(...\)", "");
            var resources = AsRepo.GetArchivesSpaceResources();
            var found     = resources.FirstOrDefault(x => x.title + $" ({x.ead_id})" == avm.NewAsResource);

            if (found == null)
            {
                TempData["Message"] = "Resource Not Found";
            }
            else
            {
                var fullDoc = GetNameDocByUuid(avm.Doc._id);
                if (asButton == "Creator")
                {
                    if (fullDoc.creator == null)
                    {
                        fullDoc.creator = new List <string>();
                    }
                    fullDoc.creator.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                }
                else if (asButton == "Source")
                {
                    if (fullDoc.source == null)
                    {
                        fullDoc.source = new List <string>();
                    }
                    fullDoc.source.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                }

                //if (asButton == "PersonalNameCreator")
                //{
                //    if (fullDoc.personalNameCreator == null) { fullDoc.personalNameCreator = new List<string>(); }
                //    fullDoc.personalNameCreator.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "PersonalNameSource")
                //{
                //    if (fullDoc.personalNameSource == null) { fullDoc.personalNameSource = new List<string>(); }
                //    fullDoc.personalNameSource.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "FamilyNameCreator")
                //{
                //    if (fullDoc.familyNameCreator == null) { fullDoc.familyNameCreator = new List<string>(); }
                //    fullDoc.familyNameCreator.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "FamilyNameSource")
                //{
                //    if (fullDoc.familyNameSource == null) { fullDoc.familyNameSource = new List<string>(); }
                //    fullDoc.familyNameSource.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "CorporateNameCreator")
                //{
                //    if (fullDoc.corporateNameCreator == null) { fullDoc.corporateNameCreator = new List<string>(); }
                //    fullDoc.corporateNameCreator.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}
                //else if (asButton == "CorporateNameSource")
                //{
                //    if (fullDoc.corporateNameSource == null) { fullDoc.corporateNameSource = new List<string>(); }
                //    fullDoc.corporateNameSource.Add(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + found.id);
                //}

                SaveNameDoc(fullDoc);
                TempData["Message"] = "Resource Added";
            }

            return(RedirectToAction("Name", new { id = avm.Doc._id }));
        }
Exemplo n.º 16
0
 public AssignWindow(int moduleId)
 {
     InitializeComponent();
     DataContext = new AssignViewModel(moduleId);
 }
 public bool AssignPerson(AssignViewModel assignView)
 {
     return(projectGateway.AssignProjectAndPerson(assignView));
 }