private void CreateReportFromInputData()
 {
     report             = new Models.Report();
     report.reason      = TextBoxReason.Text;
     report.idService   = service.idService;
     report.idMemberATE = Login.tokenAccount.idMemberATE;
 }
        public JsonResult GetStatusDonut()
        {
            IEnumerable <ToDoListVM> toDoLists = null;

            client.DefaultRequestHeaders.Add("Authorization", HttpContext.Session.GetString("JWToken"));
            var iduser   = HttpContext.Session.GetString("userid");
            var response = client.GetAsync("todolists/getstatus/" + iduser);

            response.Wait();
            var result = response.Result;

            if (result.IsSuccessStatusCode)
            {
                var data = result.Content.ReadAsAsync <IList <ToDoListVM> >();
                data.Wait();
                toDoLists = data.Result;
                List <Models.Report> chart = new List <Models.Report>();
                foreach (var c in toDoLists)
                {
                    Models.Report report = new Models.Report();
                    report.label = c.Status.ToString();
                    report.value = c.Total.ToString();
                    chart.Add(report);
                }
                var json = JsonConvert.SerializeObject(chart, Formatting.Indented);
                return(Json(json));
            }
            return(Json("internal server error"));
        }
Exemple #3
0
        /// <summary>
        /// Список студентов
        /// </summary>
        /// <returns></returns>
        public ActionResult Report()
        {
            DateTime now = DateTime.Now;
            // Доступные РК
            var alist = db.Assessments
                        .Where(x => x.StartTime < now)
                        .OrderBy(x => x.Number).ToList();
            int count = alist.Count();

            // Список групп
            var groups = db.Students.Select(a => a.Group).Distinct()
                         .Select(a => new Models.Group()
            {
                GroupName = a
            }).ToList();

            foreach (Models.Group group in groups)
            {
                var students = db.Students.Where(a => a.Group == group.GroupName).OrderBy(a => a.LastName).ToList();
                foreach (var student in students)
                {
                    group.Students.Add(new Models.Student(student, count));
                }
            }

            // Данные для отетча
            var report = new Models.Report(alist, groups);

            // Количество столбцов в отчете: фамилия, имя, группа, и на каждый РК
            ViewBag.ColSpan = 3 + count;

            return(View(report));
        }
Exemple #4
0
        public ActionResult Report()
        {
            List <Report> report = new List <Report>();

            using (RevenueManagementDbContext db = new RevenueManagementDbContext())
            {
                var rep = db.Licenses.ToList();
                if (rep == null)
                {
                    return(RedirectToAction("License"));
                }
                ViewBag.Message = rep.Count();
                rep.Reverse();
                for (int i = 0; i < rep.Count; i++)
                {
                    Report repInfo     = new Models.Report();
                    var    rp          = rep[i];
                    var    citizenInfo = db.Citizens.SingleOrDefault(r => r.Email == rp.Email);
                    if (citizenInfo != null)
                    {
                        repInfo.FirstName      = citizenInfo.FirstName;
                        repInfo.LastName       = citizenInfo.LastName;
                        repInfo.Address        = citizenInfo.Address;
                        repInfo.AmountPaid     = rep[i].AmountPaid;
                        repInfo.Email          = rep[i].Email;
                        repInfo.LicenseType    = rep[i].LicenseType;
                        repInfo.DateRegistered = rep[i].DateRegistered;
                        report.Add(repInfo);
                    }
                }
                return(View(report));
            }
        }
Exemple #5
0
        public async Task <IActionResult> Create(ReportViewModel reportVM)
        {
            if (ModelState.IsValid && !string.IsNullOrEmpty(reportVM.CategoryID) && !string.IsNullOrEmpty(reportVM.ShiftID))
            {
                var report = new Models.Report
                {
                    TicketNo       = reportVM.TicketNo,
                    Description    = reportVM.Description,
                    User           = userManager.GetUserAsync(HttpContext.User).Result,
                    Shift          = _context.Shift.SingleOrDefault(e => e.ShiftId.ToString() == reportVM.ShiftID),
                    Type           = _context.Type.SingleOrDefault(e => e.TypeId.ToString() == reportVM.TypeID),
                    Category       = _context.Category.SingleOrDefault(e => e.CategoryId.ToString() == reportVM.CategoryID),
                    onCallEscalate = _context.onCallEscalates.SingleOrDefault(e => e.OnCallEscalateId.ToString() == reportVM.OnCallEscalateID),
                    StartTime      = reportVM.StartTime,
                    EndTime        = reportVM.EndTime,
                    ArrivalTime    = reportVM.ArrivalTime,
                    TimeSpent      = reportVM.TimeSpent
                };
                _context.Add(report);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            GetReportViewModel(reportVM);
            return(View(reportVM));
        }
        public Report Map(Models.Report report)
        {
            var storageReport = new Report();

            Map(report, storageReport);
            return(storageReport);
        }
Exemple #7
0
        public async Task Get(int id)
        {
            Response.Headers.Add("Content-Type", "text/event-stream");
            Models.Report resp = new Models.Report()
            {
                id = id
            };
            int retry = 5;

            try
            {
                while (retry > 0)
                {
                    lock (DomainInfoHostedService.Engine.Cache.Reports)
                    {
                        var match = DomainInfoHostedService.Engine.Cache.Reports.SingleOrDefault(s => s.ID == id);
                        if (match == null)
                        {
                            resp.info = "No partial results yet";
                        }
                        else
                        {
                            resp.Load(match);
                            if (match.Complete)
                            {
                                resp.info = "Complete!";
                                retry     = 0;
                            }
                            else
                            {
                                resp.info = $"{(resp.reports == null ? 0 : match.TaskReports.Count)} partial result/s";
                            }
                        }
                    }
                    byte[] messageBytes = ASCIIEncoding.ASCII.GetBytes(JsonConvert.SerializeObject(resp));
                    await Response.Body.WriteAsync(messageBytes, 0, messageBytes.Length);

                    await Response.Body.FlushAsync();

                    if (retry == 0)
                    {
                        break;
                    }

                    await Task.Delay(TimeSpan.FromSeconds(3));

                    retry--;
                }
            }
            catch (Exception ex)
            {
                resp.info = $"Error:{ex.Message} : {ex.StackTrace}";
                byte[] messageBytes = ASCIIEncoding.ASCII.GetBytes(JsonConvert.SerializeObject(resp));
                await Response.Body.WriteAsync(messageBytes, 0, messageBytes.Length);

                await Response.Body.FlushAsync();
            }
        }
Exemple #8
0
        private ReportViewModel GetReportEditViewModel(Models.Report report)
        {
            var             user     = userManager.GetUserAsync(HttpContext.User).Result;
            ReportViewModel reportVM = new ReportViewModel();

            reportVM.ReportID     = report.ReportID;
            reportVM.TicketNo     = report?.TicketNo;
            reportVM.Description  = report?.Description;
            reportVM.StartTime    = ConvertToYYYYMMDD(report?.StartTime);
            reportVM.EndTime      = ConvertToYYYYMMDD(report?.EndTime);
            reportVM.ArrivalTime  = ConvertToYYYYMMDD(report?.ArrivalTime);
            reportVM.TimeSpent    = report?.TimeSpent;
            reportVM.ShiftName    = report.Shift.ShiftName;
            reportVM.CategoryName = report.Category.CategoryName;
            reportVM.TypeName     = report.Type.TypeName;
            reportVM.FilterTypes  = _context.Type.ToList();

            reportVM.Shifts = _context.Shift.Where(e => e.IsActive).Select(e => new SelectListItem
            {
                Text     = e.ShiftName,
                Value    = e.ShiftId.ToString(),
                Selected = (e.ShiftId == report.ShiftID) ? true : false
            }).ToList();
            reportVM.Types = _context.Type.Where(e => e.IsActive).Select(e => new SelectListItem
            {
                Text     = e.TypeName,
                Value    = e.TypeId.ToString(),
                Selected = (e.TypeId == report.TypeID) ? true : false
            }).ToList();
            reportVM.OnCallEscalates = _context.onCallEscalates.Where(e => e.IsActive).Select(e => new SelectListItem
            {
                Text     = e.OnCallEscalateName,
                Value    = e.OnCallEscalateId.ToString(),
                Selected = (e.OnCallEscalateId == report.onCallEscalateId) ? true : false
            }).ToList();
            if (User.IsInRole(Constants.ADMIN))
            {
                reportVM.Categories = _context.Category.Where(e => e.IsActive).Select(e => new SelectListItem
                {
                    Text     = e.CategoryName,
                    Value    = e.CategoryId.ToString(),
                    Selected = (e.CategoryId == report.CategoryID) ? true : false
                }).ToList();
            }
            else
            {
                reportVM.Categories = _context.Category.Where(e => e.IsActive && e.CategoryId == user.CategoryId).Select(e => new SelectListItem
                {
                    Text     = e.CategoryName,
                    Value    = e.CategoryId.ToString(),
                    Selected = (e.CategoryId == report.CategoryID) ? true : false
                }).ToList();
            }

            return(reportVM);
        }
 public void Map(Models.Report modelReport, Report storageReport)
 {
     storageReport.Id        = modelReport.Id;
     storageReport.UserId    = modelReport.UserId;
     storageReport.TaskId    = modelReport.TaskId;
     storageReport.ProjectId = modelReport.ProjectId;
     storageReport.Done      = modelReport.Done;
     storageReport.Planned   = modelReport.Planned;
     storageReport.Issues    = modelReport.Issues;
     storageReport.Points    = modelReport.Points;
 }
Exemple #10
0
        public static bool Convert(Models.Report report)
        {
            Application app = new Application();
            Document    doc;

            try
            {
                doc = app.Documents.Add(Path.Combine(Environment.CurrentDirectory, "template.docx"));
            }
            catch (Exception e)
            {
                app.Quit();
                throw new Exception();
            }

            doc.SaveAs2(report.title);


            string FindText    = "{name}";
            string ReplaceText = report.author;

            doc.Content.Find.Execute(FindText: FindText, ReplaceWith: ReplaceText); // Замена {name} на Фамилия И.О.


            Paragraph p; // текст
            Table     t; // таблица

            foreach (var pckg in report.Packages)
            {
                p                 = doc.Content.Paragraphs.Add();
                p.Range.Text      = "\nПакет " + pckg.name + ":";
                p.Range.Font.Bold = 20;
                p.Range.InsertParagraphAfter(); // название пакета

                foreach (var cls in pckg.Classes)
                {
                    p                 = doc.Content.Paragraphs.Add();
                    p.Range.Text      = "\n - " + cls.name + ":";
                    p.Range.Font.Bold = 0;
                    p.Range.InsertParagraphAfter(); // название класса

                    t = doc.Tables.Add(p.Range, 1, 1);
                    t.Borders.InsideLineStyle  = WdLineStyle.wdLineStyleSingle;
                    t.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle;
                    t.Cell(1, 1).Range.Text    = cls.content; // текст класса
                }
            }

            doc.Close();
            app.Quit();
            return(false);
        }
        public ReportAddOrUpdateResponseDto AddOrUpdate(ReportAddOrUpdateRequestDto request)
        {
            var entity = _repository.GetAll()
                         .FirstOrDefault(x => x.Id == request.Id && x.IsDeleted == false);

            if (entity == null)
            {
                _repository.Add(entity = new Models.Report());
            }
            entity.Title = request.Name;
            _uow.SaveChanges();
            return(new ReportAddOrUpdateResponseDto(entity));
        }
        protected void btnShowSales_Click(object sender, EventArgs e)
        {
            Models.ReportTableAdapters.DataTable2TableAdapter da = new Models.ReportTableAdapters.DataTable2TableAdapter();
            Models.Report ds = new Models.Report();
            Models.Report.DataTable2DataTable dt = (Models.Report.DataTable2DataTable)ds.Tables["DataTable2"];
            da.Fill(dt);

            Sales_Report rpt = new Sales_Report();

            rpt.SetDataSource(ds);
            CrystalReportViewer1.ReportSource = rpt;
            Session.Add("report1", rpt);
        }
Exemple #13
0
        // GET: Reports/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Models.Report report = await _context.Report.Include(e => e.Category).Include(e => e.Shift)
                                   .Include(e => e.Type).Include(e => e.User).Include(e => e.onCallEscalate).Where(e => e.ReportID == id).FirstOrDefaultAsync();

            //var report = reports.SingleOrDefault(e=>e.ReportID == id);
            if (report == null)
            {
                return(NotFound());
            }
            return(View(GetReportEditViewModel(report)));
        }
Exemple #14
0
        public void PostReportSuccess()
        {
            //Arrange
            MockModerationDAL mockModerationDAL = new MockModerationDAL();
            Guid guid = Guid.NewGuid();

            var report = new Models.Report {
                PostId = guid, ReporterId = guid, ReportId = guid
            };

            Services.ModerationService moderationService = new Services.ModerationService(mockModerationDAL);

            //Act
            var result = moderationService.PostReport(report);

            //Assert
            Assert.AreEqual(mockModerationDAL.reports.Count, 1);
        }
Exemple #15
0
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Models.Report report = await _context.Report
                                   .Include(r => r.Category)
                                   .Include(r => r.Shift)
                                   .Include(r => r.Type)
                                   .Include(r => r.User)
                                   .Include(r => r.onCallEscalate)
                                   .FirstOrDefaultAsync(m => m.ReportID == id);

            ReportViewModel reportViewModel = new ReportViewModel()
            {
                ReportID           = report.ReportID,
                Description        = report.Description,
                TicketNo           = report.TicketNo,
                CategoryName       = report.Category?.CategoryName,
                ShiftName          = report.Shift?.ShiftName,
                TypeName           = report.Type?.TypeName,
                OnCallEscalateName = report.onCallEscalate?.OnCallEscalateName,
                StartTime          = report.StartTime,
                ArrivalTime        = report.ArrivalTime,
                EndTime            = report.EndTime,
                UserName           = report.User.Name,
                TimeSpent          = report.TimeSpent
            };

            if (report == null)
            {
                return(NotFound());
            }

            return(View(reportViewModel));
        }
        public ActionResult Submit(string url, string description)
        {
            if (!string.IsNullOrWhiteSpace(url) && url.StartsWith("/"))
            {
                var model = new Models.Report();
                model.AuthorId = User.Identity.GetUserId<int>();
                model.ReportedOn = DateTime.UtcNow;
                model.Url = url;
                model.Description = description;
                ReportService.AddReport(model);
                ReportService.Save();

                return Json(new
                {
                    Code = 0
                });
            }

            return Json(new
            {
                Code = 1
            });
        }
Exemple #17
0
        public ActionResult Submit(string url, string description)
        {
            if (!string.IsNullOrWhiteSpace(url) && url.StartsWith("/"))
            {
                var model = new Models.Report();
                model.AuthorId    = User.Identity.GetUserId <int>();
                model.ReportedOn  = DateTime.UtcNow;
                model.Url         = url;
                model.Description = description;
                ReportService.AddReport(model);
                ReportService.Save();

                return(Json(new
                {
                    Code = 0
                }));
            }

            return(Json(new
            {
                Code = 1
            }));
        }
Exemple #18
0
 public Models.Report GetReport(Models.ReportRequest qp)
 {
     Models.Report resp = new Models.Report()
     {
         id = qp.Id
     };
     try
     {
         lock (DomainInfoHostedService.Engine.Cache.Reports)
         {
             var match = DomainInfoHostedService.Engine.Cache.Reports.SingleOrDefault(s => s.ID == qp.Id);
             if (match == null)
             {
                 resp.info = "No partial results yet";
                 return(resp);
             }
             if (qp.Getpartial)
             {
                 resp.Load(match);
                 resp.info = match.Complete ? "Complete!" : $"{(resp.reports == null ? 0 : match.TaskReports.Count)} partial result/s";
                 return(resp);
             }
             if (match.Complete)
             {
                 resp.Load(match);
                 resp.info = "Complete!";
                 return(resp);
             }
             resp.info = $"{(match.TaskReports.Count)} partial result/s";
         }
     }
     catch (Exception ex)
     {
         resp.info = $"Error:{ex.Message}";
     }
     return(resp);
 }
        private void RegisterReport()
        {
            RestClient client = new RestClient(urlBase);

            client.Timeout = -1;
            var request = new RestRequest("reports", Method.POST);

            foreach (RestResponseCookie cookie in Login.cookies)
            {
                request.AddCookie(cookie.Name, cookie.Value);
            }
            var json = JsonConvert.SerializeObject(report);

            request.AddHeader("Token", Login.tokenAccount.token);
            request.AddParameter("application/json", json, ParameterType.RequestBody);
            System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return(true); };
            try
            {
                IRestResponse response = client.Execute(request);
                if (response.StatusCode == System.Net.HttpStatusCode.Created || response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    report = JsonConvert.DeserializeObject <Models.Report>(response.Content);
                    MessageBox.Show("El reporte se registró exitosamente", "Registro exitoso", MessageBoxButton.OK, MessageBoxImage.Information);
                    Service service = new Service();
                    service.InitializeMenu();
                    service.Show();
                    Close();
                }
                else
                {
                    Models.Error responseError = JsonConvert.DeserializeObject <Models.Error>(response.Content);
                    MessageBox.Show(responseError.error, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    if (response.StatusCode == System.Net.HttpStatusCode.Forbidden || response.StatusCode == System.Net.HttpStatusCode.Unauthorized ||
                        response.StatusCode == System.Net.HttpStatusCode.RequestTimeout)
                    {
                        Login login = new Login();
                        login.Show();
                        Close();
                    }
                    else
                    {
                        if (response.StatusCode != System.Net.HttpStatusCode.Conflict && response.StatusCode != System.Net.HttpStatusCode.BadRequest)
                        {
                            Service service = new Service();
                            service.InitializeMenu();
                            service.Show();
                            Close();
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                TelegramBot.SendToTelegram(exception);
                LogException.Log(this, exception);
                MessageBox.Show("No se pudo registrar el reporte. Intente más tarde", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                Service service = new Service();
                service.InitializeMenu();
                service.Show();
                Close();
            }
        }
Exemple #20
0
        async void Next_Clicked(object sender, EventArgs e)
        {
            App.localizer.SetLocale(App.defaultCulture);
            try
            {
                if (App.user == null || string.IsNullOrEmpty(App.user.UserId))
                {
                    await DisplayAlert(App.localizeResProvider.GetText("Notification"), App.localizeResProvider.GetText("String159"), "Ok");
                }
                else
                {
                    var answer = await DisplayAlert(App.localizeResProvider.GetText("String160"), App.localizeResProvider.GetText("String161"), App.localizeResProvider.GetText("Yes1"), App.localizeResProvider.GetText("No1"));

                    if (answer)
                    {
                        List <Part> ListReportData = App.ListReportData;
                        #region Part 1
                        ListReportData[0].Action    = "";
                        ListReportData[0].WhoAction = "";
                        ListReportData[0].ListQuestions[0].Total = string.IsNullOrEmpty(txtTotalWard.Text) ? 0 : txtTotalWard.Text.ConvertToFloat();
                        ListReportData[0].ListQuestions[1].Total = string.IsNullOrEmpty(txt2a.Text) ? 0 : txt2a.Text.ConvertToFloat();
                        ListReportData[0].ListQuestions[2].Total = string.IsNullOrEmpty(txt3a.Text) ? 0 : txt3a.Text.ConvertToFloat();
                        ListReportData[0].ListQuestions[3].Total = string.IsNullOrEmpty(txt4a.Text) ? 0 : txt4a.Text.ConvertToFloat();
                        ListReportData[0].ListQuestions[4].Total = string.IsNullOrEmpty(txtTotalWard1.Text) ? 0 : txtTotalWard1.Text.ConvertToFloat();
                        ListReportData[0].ListQuestions[5].Total = string.IsNullOrEmpty(txt6a.Text) ? 0 : txt6a.Text.ConvertToFloat();
                        ListReportData[0].ListQuestions[6].Total = string.IsNullOrEmpty(txt7a.Text) ? 0 : txt7a.Text.ConvertToFloat();
                        ListReportData[0].ListQuestions[7].Total = string.IsNullOrEmpty(txt8a.Text) ? 0 : txt8a.Text.ConvertToFloat();
                        ListReportData[0].ListQuestions[8].Total = string.IsNullOrEmpty(txt9a.Text) ? 0 : txt9a.Text.ConvertToFloat();

                        ListReportData[0].ListQuestions[0].Note = txtTotalWard.Text;
                        ListReportData[0].ListQuestions[1].Note = txt2a.Text;
                        ListReportData[0].ListQuestions[2].Note = txt3a.Text;
                        ListReportData[0].ListQuestions[3].Note = txt4a.Text;
                        ListReportData[0].ListQuestions[4].Note = txtTotalWard1.Text;
                        ListReportData[0].ListQuestions[5].Note = txt6a.Text;
                        ListReportData[0].ListQuestions[6].Note = txt7a.Text;
                        ListReportData[0].ListQuestions[7].Note = txt8a.Text;
                        ListReportData[0].ListQuestions[8].Note = txt9a.Text;
                        #endregion
                        #region Part 2
                        ListReportData[1].Action    = txtAction.Text;
                        ListReportData[1].WhoAction = txtWhoAction.Text;
                        ListReportData[1].ListQuestions[0].Total = string.IsNullOrEmpty(txt1b.Text) ? 0 : txt1b.Text.ConvertToFloat();
                        ListReportData[1].ListQuestions[1].Total = string.IsNullOrEmpty(txt2b.Text) ? 0 : txt2b.Text.ConvertToFloat();
                        ListReportData[1].ListQuestions[2].Total = string.IsNullOrEmpty(txt3b.Text) ? 0 : txt3b.Text.ConvertToFloat();
                        ListReportData[1].ListQuestions[3].Total = string.IsNullOrEmpty(txt4b.Text) ? 0 : txt4b.Text.ConvertToFloat();
                        //ListReportData[0].ListQuestions[4].Total = string.IsNullOrEmpty(txt4b.Text) ? 0 : txt4b.Text.ConvertToFloat();

                        ListReportData[1].ListQuestions[0].Note = txt1b.Text;
                        ListReportData[1].ListQuestions[1].Note = txt2b.Text;
                        ListReportData[1].ListQuestions[2].Note = txt3b.Text;
                        ListReportData[1].ListQuestions[3].Note = txt4b.Text;
                        ListReportData[1].ListQuestions[4].Note = txt5b.Text;
                        #endregion
                        #region Part 3
                        ListReportData[2].Action    = txtAction.Text;
                        ListReportData[2].WhoAction = txtWhoAction.Text;
                        ListReportData[2].ListQuestions[0].Total  = string.IsNullOrEmpty(txt1c.Text) ? 0 : txt1c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[1].Total  = string.IsNullOrEmpty(txt2c.Text) ? 0 : txt2c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[2].Total  = string.IsNullOrEmpty(txt3c.Text) ? 0 : txt3c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[3].Total  = string.IsNullOrEmpty(txt4c.Text) ? 0 : txt4c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[4].Total  = string.IsNullOrEmpty(txt5c.Text) ? 0 : txt5c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[5].Total  = string.IsNullOrEmpty(txt6c.Text) ? 0 : txt6c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[6].Total  = string.IsNullOrEmpty(txt7c.Text) ? 0 : txt7c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[7].Total  = string.IsNullOrEmpty(txt8c.Text) ? 0 : txt8c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[8].Total  = string.IsNullOrEmpty(txt9c.Text) ? 0 : txt9c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[9].Total  = string.IsNullOrEmpty(txt10c.Text) ? 0 : txt10c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[10].Total = string.IsNullOrEmpty(txt11c.Text) ? 0 : txt11c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[11].Total = string.IsNullOrEmpty(txt12c.Text) ? 0 : txt12c.Text.ConvertToFloat();
                        ListReportData[2].ListQuestions[12].Note  = txt13c.Text;

                        ListReportData[2].ListQuestions[0].Note  = txt1c.Text;
                        ListReportData[2].ListQuestions[1].Note  = txt2c.Text;
                        ListReportData[2].ListQuestions[2].Note  = txt3c.Text;
                        ListReportData[2].ListQuestions[3].Note  = txt4c.Text;
                        ListReportData[2].ListQuestions[4].Note  = txt5c.Text;
                        ListReportData[2].ListQuestions[5].Note  = txt6c.Text;
                        ListReportData[2].ListQuestions[6].Note  = txt7c.Text;
                        ListReportData[2].ListQuestions[7].Note  = txt8c.Text;
                        ListReportData[2].ListQuestions[8].Note  = txt9c.Text;
                        ListReportData[2].ListQuestions[9].Note  = txt10c.Text;
                        ListReportData[2].ListQuestions[10].Note = txt11c.Text;
                        ListReportData[2].ListQuestions[11].Note = txt12c.Text;
                        #endregion
                        if (App.IsConnectivity)
                        {
                            #region Neu nhu co mang
                            RestClient    restClient = App.restClient;
                            Models.Report report     = new Models.Report();
                            report.Data        = JsonConvert.SerializeObject(ListReportData);
                            report.CreatedTime = DateTime.Now;
                            report.ReportType  = 0;
                            report.Event       = ListEvent[picEvent.SelectedIndex];
                            report.Status      = 0;
                            report.Location    = App.user.Location;
                            report.User        = App.user;
                            var result = await restClient.PostAsync("reports", report);

                            if (result.ToUpper().Equals(ApiStatusConstant.SUCCESS))
                            {
                                await DisplayAlert(App.localizeResProvider.GetText("Notification"), App.localizeResProvider.GetText("String157"), "Ok");
                            }
                            else
                            {
                                await DisplayAlert(App.localizeResProvider.GetText("Notification"), App.localizeResProvider.GetText("String158"), "Ok");
                            }
                            #endregion
                        }
                        else
                        {
                            try
                            {
                                #region Neu nhu ko co mang
                                if (App._connection == null)
                                {
                                    App._connection = new SQLite.SQLiteConnection(Connection.GetConnection());
                                }
                                var        repository = App.Get <ReportRepository>();
                                ReportLite reportLite = new ReportLite();
                                reportLite.Data        = JsonConvert.SerializeObject(ListReportData);
                                reportLite.CreatedTime = DateTime.Now;
                                reportLite.ReportType  = 0;
                                reportLite.EventId     = ListEvent[picEvent.SelectedIndex].EventId;
                                reportLite.Status      = 0;
                                reportLite.LocationId  = App.user.Location != null ? App.user.Location.LocationId : 0;
                                reportLite.UserId      = App.user.UserId;
                                repository.Create(reportLite);
                                #endregion
                                await DisplayAlert(App.localizeResProvider.GetText("Notification"), App.localizeResProvider.GetText("String157"), "Ok");
                            }
                            catch
                            {
                                await DisplayAlert(App.localizeResProvider.GetText("Notification"), App.localizeResProvider.GetText("String158"), "Ok");
                            }
                        }
                        var existingPages = Navigation.NavigationStack.ToList();
                        for (int i = 1; i < existingPages.Count; i++)
                        {
                            Navigation.RemovePage(existingPages[i]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert(App.localizeResProvider.GetText("Notification"), "Có lỗi xảy ra!", "Ok");
            }
        }
Exemple #21
0
 public IActionResult CreateReport([FromBody] Models.Report reportModel)
 {
     return(Ok(Imdb.Imdb.CreateReport(reportModel)));
 }
Exemple #22
0
 public void AddReport(Models.Report model)
 {
     db.Reports.Add(model);
 }
Exemple #23
0
 public ReportAddOrUpdateResponseDto(Models.Report entity)
     : base(entity)
 {
 }
 public ReportDto(Models.Report entity)
 {
     Id   = entity.Id;
     Name = entity.Title;
 }
Exemple #25
0
        async void Next_Clicked(object sender, EventArgs e)
        {
            App.localizer.SetLocale(App.defaultCulture);
            try
            {
                if (App.user == null || string.IsNullOrEmpty(App.user.UserId))
                {
                    await DisplayAlert(App.localizeResProvider.GetText("Notification"), App.localizeResProvider.GetText("String159"), "Ok");
                }
                else
                {
                    var answer = await DisplayAlert(App.localizeResProvider.GetText("String160"), App.localizeResProvider.GetText("String161"), App.localizeResProvider.GetText("Yes1"), App.localizeResProvider.GetText("No1"));

                    if (answer)
                    {
                        SetData();
                        if (App.IsConnectivity)
                        {
                            #region neu nhu co mang
                            App.ReportTextReplace = App.ReportText.ReplaceData(App.ListReport);
                            RestClient    restClient = App.restClient;
                            Models.Report report     = new Models.Report();
                            report.Data        = App.ReportTextReplace;
                            report.CreatedTime = DateTime.Now;
                            report.ReportType  = 1;
                            report.Event       = ListEvent[picEvent.SelectedIndex];
                            report.Status      = 0;
                            report.User        = App.user;
                            report.Location    = App.user.Location;
                            var result = await restClient.PostAsync("reports", report);

                            if (result.ToUpper().Equals(ApiStatusConstant.SUCCESS))
                            {
                                App.ListReport = ReportQuestion.initReport();
                                await DisplayAlert(App.localizeResProvider.GetText("Notification"), App.localizeResProvider.GetText("String157"), "Ok");
                            }
                            else
                            {
                                await DisplayAlert(App.localizeResProvider.GetText("Notification"), App.localizeResProvider.GetText("String158"), "Ok");
                            }
                            #endregion
                            var existingPages = Navigation.NavigationStack.ToList();
                            for (int i = 1; i < existingPages.Count; i++)
                            {
                                Navigation.RemovePage(existingPages[i]);
                            }
                        }
                        else
                        {
                            #region Neu nhu mat mang
                            if (App._connection == null)
                            {
                                App._connection = new SQLite.SQLiteConnection(Connection.GetConnection());
                            }
                            try
                            {
                                //Bao cao sau tham hoa offline
                                var        repository = App.Get <ReportRepository>();
                                ReportLite reportLite = new ReportLite();
                                reportLite.Data        = JsonConvert.SerializeObject(App.ListReport);
                                reportLite.CreatedTime = DateTime.Now;
                                reportLite.ReportType  = 1;
                                reportLite.EventId     = ListEvent[picEvent.SelectedIndex].EventId;
                                reportLite.Status      = 0;
                                reportLite.LocationId  = App.user.Location != null ? App.user.Location.LocationId : 0;
                                reportLite.UserId      = App.user.UserId;
                                repository.Create(reportLite);
                                App.ListReport = ReportQuestion.initReport();
                                await DisplayAlert(App.localizeResProvider.GetText("Notification"), App.localizeResProvider.GetText("String157"), "Ok");
                            }
                            catch
                            {
                                await DisplayAlert(App.localizeResProvider.GetText("Notification"), App.localizeResProvider.GetText("String158"), "Ok");
                            }
                            #endregion
                            var existingPages = Navigation.NavigationStack.ToList();
                            for (int i = 1; i < existingPages.Count; i++)
                            {
                                Navigation.RemovePage(existingPages[i]);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }