Ejemplo n.º 1
0
        public async Task <FileResult> GetDocumentHandler(Int32 id)
        {
            ConsumerEmployeeDocumentsManagement manage = new ConsumerEmployeeDocumentsManagement(_context);

            var document = await manage.GetDocument(id);

            if (document != null)
            {
                var filePath = manage.GetDocumentPath(this) + document.DocumentPath;
                if (System.IO.File.Exists(filePath))
                {
                    if (String.IsNullOrEmpty(document.DocumentContentType))
                    {
                        document.DocumentContentType = "application/binary";
                    }
                    var res      = document.DocumentPath.Split('.');
                    var fileName = document.Contact.LastName + "_" + document.Contact.FirstName + " (" + document.EmployeeDocumentType.Name + ")";
                    if (res.Length > 1)
                    {
                        fileName += "." + res[1];
                    }
                    Response.AddHeader("Content-Disposition", "inline; filename=" + fileName);

                    return(File(filePath, document.DocumentContentType));
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Save()
        {
            var serializer = new JavaScriptSerializer();

            serializer.MaxJsonLength = Int32.MaxValue;
            string data = new System.IO.StreamReader(Request.InputStream).ReadToEnd();
            ConsumerDocumentViewModel model = serializer.Deserialize <ConsumerDocumentViewModel>(data);

            if (User == null)
            {
                return(null);
            }
            ConsumerEmployeeDocumentsManagement manage = new ConsumerEmployeeDocumentsManagement(_context);
            Int32 id = 0;

            if (model.EmployeeDocumentId == null)
            {
                model.DateCreated = DateTime.Now;
                id = await manage.Save(model.GetModel(), model.GetNotesModel(), model.FileData, this);
            }
            else
            {
                id = model.EmployeeDocumentId.Value;
                await manage.Save(model.GetModel(), model.GetNotesModel(), model.FileData, this);
            }
            var document = await manage.GetDocument(id);

            return(Json(new { status = "ok", id = id, filePath = document.DocumentPath }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Delete(Int32 id)
        {
            if (User == null)
            {
                return(null);
            }

            ConsumerEmployeeDocumentsManagement manage = new ConsumerEmployeeDocumentsManagement(_context);

            if (!await manage.Delete(id, this))
            {
                return(Json(new { status = "error", message = "You can't delete this record. Please contact to support team." }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { status = "ok" }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        // GET: Consumers
        public async Task <ActionResult> Index()
        {
            ConsumerManagement cm = new ConsumerManagement(_context);
            ConsumerEmployeeDocumentsManagement docs           = new ConsumerEmployeeDocumentsManagement(_context);
            ConsumerHabPlansManagement          habPlans       = new ConsumerHabPlansManagement(_context);
            ConsumerPrintDocumentsManagement    printDocuments = new ConsumerPrintDocumentsManagement(_context);
            ConsumerNotesManagement             notes          = new ConsumerNotesManagement(_context);
            ConsumerNotificationsManagement     notifications  = new ConsumerNotificationsManagement(_context);

            var lists            = new Dictionary <String, List <ItemListViewModel> >();
            var dayProgram       = ItemListViewModel.GetList(await cm.GetList("Day Programs"));
            var diagnosis        = ItemListViewModel.GetList(await cm.GetList("Diagnosis"));
            var status           = ItemListViewModel.GetList(await cm.GetList("Status"));
            var agencyName       = ItemListViewModel.GetAgencyNameList(await cm.GetAgencyNamesList());
            var phoneTypes       = ItemListViewModel.GetList(await cm.GetList("Phone Types"));
            var unitQuantities   = ItemListViewModel.GetList(await cm.GetList("Unit Quantities"));
            var fullServicesData = await cm.GetServiceList();

            var services = ItemListViewModel.GetList(fullServicesData);

            var docStatuses = ItemListViewModel.GetList(await docs.GetDocStatuses());
            var docTypes    = await docs.GetDocTypes();

            var habPlanStatuses    = ItemListViewModel.GetList(await habPlans.GetStatuses());
            var habPlanDurations   = ItemListViewModel.GetList(await habPlans.GetDurations());
            var habPlanFrequencies = ItemListViewModel.GetList(await habPlans.GetFrequencies());

            var printDocumentsTypes = ItemListViewModel.GetList(await printDocuments.GetTypes());

            var noteTypes     = ItemListViewModel.GetList(await notes.GetTypes());
            var noteFromTypes = ItemListViewModel.GetList(await notes.GetFromTypes());

            var notificationStatuses       = ItemListViewModel.GetList(await notifications.GetStatuses());
            var notificationRepeatingTypes = ItemListViewModel.GetList(await notifications.GetTypes());
            var serviceTypesList           = ItemListViewModel.GetList(await printDocuments.GetServiceTypes());
            var serviceTypesExList         = ItemListViewModel.GetExList(await printDocuments.GetServiceTypes());

            lists.Add("DayPrograms", dayProgram);
            lists.Add("Diagnosis", diagnosis);
            lists.Add("Status", status);
            lists.Add("AgencyName", agencyName);
            lists.Add("PhoneTypesList", phoneTypes);
            lists.Add("ServicesList", services);
            lists.Add("ServiceTypesList", serviceTypesList);
            lists.Add("ServiceTypesExList", serviceTypesExList);

            lists.Add("UnitQuantitiesList", unitQuantities);
            lists.Add("EmployeeDocumentStatuses", docStatuses);

            lists.Add("HabPlanStatuses", habPlanStatuses);
            lists.Add("HabPlanDurations", habPlanDurations);
            lists.Add("HabPlanFrequencies", habPlanFrequencies);

            lists.Add("PrintDocumentTypes", printDocumentsTypes);
            lists.Add("NoteTypes", noteTypes);
            lists.Add("NoteFromTypes", noteFromTypes);

            lists.Add("NotificationStatusesList", notificationStatuses);
            lists.Add("RepeatingTypesList", notificationRepeatingTypes);
            ViewData["Lists"] = lists;
            ViewData["EmployeeDocumentTypes"] = docTypes;
            ViewData["QIDP"] = WebConfigurationManager.AppSettings["QIDP"];
            ViewData["FullDataServicesList"] = ItemListViewModel.GetClientList <ServicesList, ServicesListViewModel>(fullServicesData);
            return(View());
        }
Ejemplo n.º 5
0
        public async Task <ActionResult> Get(String id)
        {
            if (User == null)
            {
                return(null);
            }

            if (String.IsNullOrEmpty(id))
            {
                return(null);
            }
            Int32 consumerId = Int32.Parse(id);
            ConsumerManagement                  manage               = new ConsumerManagement(_context);
            ConsumerPhonesManagement            managePhones         = new ConsumerPhonesManagement(_context);
            ConsumerEmployeeManagement          manageEmployees      = new ConsumerEmployeeManagement(_context);
            ConsumerServicesManagement          manageServices       = new ConsumerServicesManagement(_context);
            ConsumerEmployeeDocumentsManagement manageDocuments      = new ConsumerEmployeeDocumentsManagement(_context);
            ConsumerHabPlansManagement          manageHabPlans       = new ConsumerHabPlansManagement(_context);
            ConsumerHabReviewsManagement        manageHabReviews     = new ConsumerHabReviewsManagement(_context);
            ConsumerPrintDocumentsManagement    managePrintDocuments = new ConsumerPrintDocumentsManagement(_context);
            ConsumerCallLogsManagement          manageCallLogs       = new ConsumerCallLogsManagement(_context);
            ConsumerNotesManagement             manageNotes          = new ConsumerNotesManagement(_context);
            ConsumerNotificationsManagement     manageNotifications  = new ConsumerNotificationsManagement(_context);

            var consumer = await manage.GetConsumer(consumerId);

            if (consumer == null)
            {
                return(null);
            }
            var phones = await managePhones.GetPhones(consumerId);

            var employees = await manageEmployees.GetEmployees(consumerId);

            var services = await manageServices.GetServices(consumerId);

            var documents = await manageDocuments.GetDocuments(consumerId);

            var habPlans = await manageHabPlans.GetHabPlans(consumerId);

            var habReviews = await manageHabReviews.GetHabReviews(consumerId);

            var printDocuments = await managePrintDocuments.GetPrintDocuments(consumerId);

            var callLogs = await manageCallLogs.GetCallLogs(consumerId);

            var notes = await manageNotes.GetNotes(consumerId);

            var notifications = await manageNotifications.GetNotifications(consumerId);

            var uploadFiles             = FileDataService.GetConsumerFiles(_context, consumerId);
            ConsumerFullViewModel model = new ConsumerFullViewModel(consumer);

            model.SetPhones(phones);
            model.SetEmployees(employees);
            model.SetApprovedServices(services);
            model.SetDocuments(documents);
            model.SetHabPlans(habPlans);
            model.SetHabReviews(habReviews);
            model.SetPrintDocuments(printDocuments);
            model.SetCallLogs(callLogs);
            model.SetNotes(notes);
            model.SetNotifications(notifications);
            model.SetUploadFiles(uploadFiles);
            return(Json(model, JsonRequestBehavior.AllowGet));
        }