Example #1
0
        /// <summary>
        /// 根据搜索条件获取寝室列表
        /// </summary>
        /// <param name="webModel">列表页视图模型</param>
        /// <param name="context">数据库上下文对象</param>
        /// <returns></returns>
        public static async Task <List <Dorm> > GetListAsync(InformationViewModel webModel, ApplicationDbContext context)
        {
            if (string.IsNullOrEmpty(webModel.SName) && string.IsNullOrEmpty(webModel.SType) && webModel.SFloor == -1)
            {
                return(await context.Set <Dorm>().AsNoTracking().Skip(webModel.Start).Take(webModel.Limit).OrderByDescending(i => i.CreatedOn).ToListAsync());
            }
            else
            {
                IQueryable <Dorm> dorms = context.Dorm.AsQueryable();

                var predicate = PredicateBuilder.New <Dorm>();

                //宿舍楼编号
                if (!string.IsNullOrEmpty(webModel.SName))
                {
                    predicate = predicate.And(i => i.Name == webModel.SName);
                }

                //宿舍楼类型
                if (!string.IsNullOrEmpty(webModel.SType))
                {
                    predicate = predicate.And(i => i.BunkName == webModel.SType);
                }

                //宿舍楼是否启用
                if (webModel.SFloor != -1)
                {
                    predicate = predicate.And(i => i.Floor == webModel.SFloor);
                }

                return(await dorms.AsExpandable().Where(predicate).ToListAsync());
            }
        }
Example #2
0
        public async Task <IActionResult> Informations(InformationViewModel informationViewModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                Enum.TryParse(Request.Form["pregnancyType"], out TypPregnancy typPregnancy);
                informationViewModel.Patient.Pregnancy.TypPregnancy = typPregnancy;

                Enum.TryParse(Request.Form["positionType"], out TypPosition typPosition);
                informationViewModel.Patient.Pregnancy.Position = typPosition;

                Enum.TryParse(Request.Form["allaitementType"], out Allaitement typAllaitement);
                informationViewModel.Patient.Born.Allaitement = typAllaitement;

                await _patientViewModelService.UpdatePatientWithInformation(informationViewModel.Patient);

                return(RedirectToAction("Index", "Family", informationViewModel.Patient.Id));
            }

            catch (Exception exp)
            {
                throw (exp);
            }
        }
        public InformationViewModel Information(string username)
        {
            var allMessages = this.Context.Messages.Where(x => x.Receiver.UserName == username).ProjectTo <MessageOutputModel>(Mapper.ConfigurationProvider).ToList();

            var newMessages = allMessages.Where(x => x.IsReaded == false).ToArray();

            var oldMessages = allMessages.Where(x => newMessages.All(z => z.Id != x.Id)).ToArray();

            var comments = this.Context.Comments
                           .Where(x => x.GetShreddedUser.UserName == username)
                           .ProjectTo <CommentOutputModel>(Mapper.ConfigurationProvider).ToArray();

            var notifications = this.Context.Notifications
                                .Where(x => x.GetShreddedUser.UserName == username)
                                .ProjectTo <NotificationOutputModel>(Mapper.ConfigurationProvider).ToList();

            var model = new InformationViewModel
            {
                NewMessages   = newMessages,
                OldMessages   = oldMessages,
                Notifications = notifications,
                UserComments  = comments
            };

            return(model);
        }
Example #4
0
        /// <summary>
        /// 搜索新生信息
        /// </summary>
        /// <param name="webModel">列表页视图Model</param>
        /// <param name="context">数据库连接上下文对象</param>
        /// <returns></returns>
        public async Task <InformationViewModel> SearchStudentAsync(InformationViewModel webModel, ApplicationDbContext context)
        {
            try
            {
                //Source Data List
                var list = await NewbornRepository.GetListAsync(webModel, context);

                //Return Data List
                var dataList = new List <StudentData>();

                if (list != null && list.Any())
                {
                    dataList.AddRange(list.Select(item => new StudentData
                    {
                        Id         = item.Id.ToString(),
                        Name       = item.Name,
                        Address    = item.Province + " " + item.City,
                        Department = item.Department,
                        MajorClass = item.MajorClass,
                        Age        = item.Age,
                        Gender     = item.Gender
                    }));
                }

                webModel.StudentList = dataList;
                webModel.Total       = await NewbornRepository.GetListCountAsync(webModel, context);
            }
            catch (Exception ex)
            {
                _logger.LogError("获取新生列表失败:{0},\r\n内部错误信息:{1}", ex.Message, ex.InnerException.Message);
            }
            return(webModel);
        }
        public ActionResult Information(string select)
        {
            switch (select)
            {
            case "查询记录":
                //Session["LoginRecord"] = !Convert.ToBoolean(Session["LoginRecord"]);
                IsShowRecordTable = !IsShowRecordTable;
                break;

            case "修改信息":
                Session["LoginRecord"] = false;
                break;

            default:
                break;
            }

            //个人信息页面视图模型
            InformationBusinessLayer informationBusinessLayer = new InformationBusinessLayer();
            string name     = Session["User"].ToString();
            string password = Session["Password"].ToString();
            InformationViewModel informationViewModel = informationBusinessLayer.getInformationViewModel(name, password);

            informationViewModel.UserName = Session["User"].ToString();

            return(View("Information", informationViewModel));
        }
Example #6
0
        public IActionResult Information()
        {
            InformationViewModel model =
                new InformationViewModel(InformationPageTitle);

            model.welcome = "Our vision: Be a guild that values loyalty," +
                            " community, friendships and \"fun\" more than" +
                            " \"progression\" or \"competition.\" We don't know if we" +
                            " will make it to level 60 or how Blizzard will develop" +
                            " Classic WoW. We might get to level 10 and get bored, or" +
                            " we might get obsessed and attempt to get world firsts!" +
                            " (Probably won't happen).\n\nHowever, we plan to participate" +
                            " in this grand adventure and see where we end up." +
                            " Progression may not be the primary focus of this guild" +
                            " right now, but it could be! This depends upon the coming" +
                            " weeks and months and how we grow as a community.";

            model.charter     = ParisDummyText;
            model.rules       = TokyoDummyText;
            model.loot        = ParisDummyText;
            model.addons      = TokyoDummyText;
            model.recruitment = ParisDummyText;

            return(View(model));
        }
Example #7
0
        public ActionResult Index()
        {
            ApplicationDbContext db   = new ApplicationDbContext();
            InformationViewModel info = new InformationViewModel();


            double[] weightArray = { 151.5, 150, 149, 148.5, 148, 147.5, 147, 146.5, 146, 145.8 }; //gray and EXPECTED
            ViewBag.intArray = weightArray;

            double[] expectedWeightArray = { 151.3, 151, 149.9, 148.5, 147, 146.8, 146, 146.8, 146, 145.1 }; // need expected weight loss controller
            ViewBag.expArray = expectedWeightArray;

            var userid = User.Identity.GetUserId();

            ViewBag.firstname = db.UserInformations.Where(x => x.UserID == userid).Select(y => y.firstName).FirstOrDefault();
            ViewBag.weight    = db.UserInformations.Where(x => x.UserID == userid).Select(y => y.weight).FirstOrDefault();
            ViewBag.height    = db.UserInformations.Where(x => x.UserID == userid).Select(h => h.height).FirstOrDefault();
            ViewBag.age       = db.UserInformations.Where(x => x.UserID == userid).Select(y => y.age).FirstOrDefault();

            ViewBag.bmi = db.WeightLosses.Where(x => x.UserID == userid).Select(y => y.BMI).FirstOrDefault();
            ViewBag.bmr = db.WeightLosses.Where(x => x.UserID == userid).Select(y => y.BMR).FirstOrDefault();

            var bmr             = db.WeightLosses.Where(x => x.UserID == userid).Select(y => y.BMR).FirstOrDefault();
            var mult            = db.WeightLosses.Where(x => x.UserID == userid).Select(y => y.activityMultiplier).FirstOrDefault();
            var calNeededPerDay = bmr * mult;

            ViewBag.recommendedCalIntake = Math.Round(calNeededPerDay);
            ViewBag.calBurned            = bmr + 346;
            //List<string> hi = new List<string>(){ "a", "b", "c" }; testing graph labels only
            //ViewBag.hello = hi;

            db.SaveChanges();
            return(View());
        }
Example #8
0
        /// <summary>
        /// 新增教职工信息
        /// </summary>
        /// <param name="webModel">编辑页视图Model</param>
        /// <param name="context">数据库上下文对象</param>
        /// <returns></returns>
        public static async Task <Register> InsertAsync(InformationViewModel webModel, ApplicationDbContext context)
        {
            //Get Foreign Key Association Table Information
            //
            var user = await context.IdentityUser.AsNoTracking().Where(i => i.Id == CurrentUser.UserId).FirstOrDefaultAsync();

            //return error
            if (user == null)
            {
                return(new Register
                {
                    Id = -1
                });
            }

            var model = InsertModel(webModel);

            model.Department   = user.Department;
            model.DepartmentId = user.DepartmentId;
            model.Instructor   = user.InstructorName;
            model.InstructorId = user.InstructorId;
            model.MajorClass   = user.MajorClass;
            model.MajorClassId = user.MajorClassId;
            model.Name         = user.Name;
            model.StudentId    = user.Id;

            await context.Register.AddAsync(model);

            return(model);
        }
Example #9
0
        /// <summary>
        /// 搜索宿舍信息
        /// </summary>
        /// <param name="webModel">列表页视图Model</param>
        /// <param name="context">数据库连接上下文对象</param>
        /// <returns></returns>
        public async Task <InformationViewModel> SearchInformationAsync(InformationViewModel webModel, ApplicationDbContext context)
        {
            try
            {
                //Source Data List
                var list = await DormitoryRepository.GetListAsync(webModel, context);

                //Return Data List
                var dataList = new List <InformationData>();

                if (list != null && list.Any())
                {
                    dataList.AddRange(list.Select(item => new InformationData
                    {
                        Id            = item.Id.ToString(),
                        Name          = item.Name,
                        BuildingName  = item.BuildingName,
                        Floor         = item.Floor,
                        Type          = item.BunkName,
                        Count         = item.Count,
                        SelectedCount = item.SelectedCount,
                        IsEnabled     = item.IsEnabled
                    }));
                }

                webModel.InformationList = dataList;
                webModel.Total           = await DormitoryRepository.GetListCountAsync(webModel, context);
            }
            catch (Exception ex)
            {
                _logger.LogError("获取宿舍列表失败:{0},\r\n内部错误信息:{1}", ex.Message, ex.InnerException.Message);
            }
            return(webModel);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TreeWatch.BlockInformationContentPage"/> class.
        /// </summary>
        /// <param name="informationViewModel">Information view model.</param>
        public BlockInformationContentPage(InformationViewModel informationViewModel)
        {
            this.InitializeComponent();

            // set view model
            this.BindingContext = informationViewModel;
        }
Example #11
0
        public IActionResult UploadFilesAjax()
        {
            vm = new ViewModel.InformationViewModel();
            var file = Request.Form.Files;

            using (var ms = new MemoryStream())
            {
                foreach (var item in file)
                {
                    item.CopyTo(ms);
                    var ArrayImage = ms.ToArray();
                    vm.Image = new List <WebEventoo_DomainClasses.Model.Images>
                    {
                        new WebEventoo_DomainClasses.Model.Images
                        {
                            Id        = file.Count,
                            ImageData = ms.ToArray(),
                            NameImage = item.Name
                        }
                    };
                }
            }
            string message = $" فایل با موفقیت اپلود شد!";

            return(Json(message));
        }
Example #12
0
 public async Task <IActionResult> Users(InformationViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
     }
     return(View());
 }
Example #13
0
        public async Task <IActionResult> Index()
        {
            List <InformationViewModel> information = new List <InformationViewModel>();

            //get all the certificates
            var certificates = await context.GetAsync <tblInfo>();

            foreach (var certificate in certificates)
            {
                //get branch
                var branch = await Task.Run(() => context.Get <tblBranch>((x) => x.Id == certificate.Branch_FK));

                //get user
                var user = await userManager.FindByIdAsync(certificate.User_FK);

                InformationViewModel _information = new InformationViewModel()
                {
                    Branch      = branch?.Name,
                    Code        = branch.Code,
                    Branch_FK   = branch.Id,
                    Id          = certificate.Id,
                    Certificate = certificate.Certificate,
                    Created     = certificate.Created,
                    Username    = user?.Email,
                    User_FK     = user?.Id,
                };

                information.Add(_information);
            }

            return(View(information));
        }
Example #14
0
        /// <summary>
        /// 查找当前用户报名信息
        /// </summary>
        /// <param name="id">学生编号</param>
        /// <param name="context">数据库连接上下文对象</param>
        /// <returns></returns>
        public async Task <InformationViewModel> GetInformationAsync(long id, ApplicationDbContext context)
        {
            var webModel = new InformationViewModel();

            try
            {
                //Get register Data
                var register = await RegisterRepository.GetEntityAsync(id, context);

                if (register != null)
                {
                    webModel.ArriveTime = register.ArriveTime.ToString("yyyy-MM-dd");
                    webModel.ExpressId  = register.ExpressId;
                    webModel.Id         = register.Id.ToString();
                    webModel.IsExpress  = register.IsExpress;
                    webModel.Place      = register.Place;
                    webModel.Remark     = register.Remark;
                    webModel.Way        = register.Way;
                }

                var user = await PSURepository.GetUserByIdAsync(CurrentUser.UserId, context);

                webModel.SId        = user.Id.ToString();
                webModel.Department = user.Department;
                webModel.MajorClass = user.MajorClass;
                webModel.Name       = user.Name;
            }
            catch (Exception ex)
            {
                _logger.LogError("获取用户报名数据失败:{0},\r\n内部错误信息:{1}", ex.Message, ex.InnerException.Message);
            }
            return(webModel);
        }
        public async Task <IActionResult> SignUp(InformationViewModel webModel)
        {
            if (ModelState.IsValid)
            {
                bool flag;
                if (string.IsNullOrEmpty(webModel.Id))
                {
                    //Add Register
                    flag = await _service.InsertInformationAsync(webModel, _context);
                }
                else
                {
                    return(Json(new
                    {
                        success = false,
                        msg = "预报名信息禁止修改"
                    }));
                }

                return(Json(new
                {
                    success = flag,
                    msg = flag ? "预报名成功" : "预报名失败"
                }));
            }

            return(Json(new
            {
                success = false,
                msg = this.ModelState.Keys.SelectMany(key => this.ModelState[key].Errors).FirstOrDefault().ErrorMessage
            }));
        }
Example #16
0
        private byte[] BuildDashboardViewModelAsByteArray()
        {
            InformationViewModel informationViewModel = new InformationViewModel
            {
                InformationIdentifier = Guid.NewGuid().ToString("D"),
                Timestamp             = DateTime.Now,
                Header      = Guid.NewGuid().ToString("D"),
                Summary     = Guid.NewGuid().ToString("D"),
                Details     = Guid.NewGuid().ToString("D"),
                ImageUrl    = Guid.NewGuid().ToString("D"),
                Provider    = Guid.NewGuid().ToString("D"),
                Author      = Guid.NewGuid().ToString("D"),
                ExternalUrl = Guid.NewGuid().ToString("D")
            };
            ImageViewModel <InformationViewModel> imageViewModel = new ImageViewModel <InformationViewModel>(informationViewModel, Convert.FromBase64String("R0lGODlhDgAOAKIAAAAAAP///wAAgP//AP8AAMDAwICAgP///yH5BAEAAAcALAAAAAAOAA4AAAM+aLq8YCPIOGV5YdV5IRFgCAbdFlFDNygkWRQGiXHZkj5rXKDWHBUu2A3C2jFkMRolMDyReMiXdCoFWK/YbAIAOw=="));

            SystemErrorViewModel systemErrorViewModel = new SystemErrorViewModel
            {
                SystemErrorIdentifier = Guid.NewGuid().ToString("D"),
                Timestamp             = DateTime.Now,
                Message = Guid.NewGuid().ToString("D"),
                Details = Guid.NewGuid().ToString("D"),
            };

            ObjectViewModel <IRedditAuthenticatedUser> redditAuthenticatedUserObjectViewModel = new ObjectViewModel <IRedditAuthenticatedUser>
            {
                ObjectIdentifier = Guid.NewGuid().ToString("D"),
                Object           = new RedditAuthenticatedUser(),
                Timestamp        = DateTime.Now,
                Html             = Guid.NewGuid().ToString("D")
            };

            ObjectViewModel <IRedditSubreddit> redditSubredditObjectViewModel = new ObjectViewModel <IRedditSubreddit>
            {
                ObjectIdentifier = Guid.NewGuid().ToString("D"),
                Object           = new RedditSubreddit(),
                Timestamp        = DateTime.Now,
                Html             = Guid.NewGuid().ToString("D")
            };

            DashboardViewModel dashboardViewModel = new DashboardViewModel
            {
                Informations = new List <InformationViewModel> {
                    informationViewModel
                },
                LatestInformationsWithImage = new List <ImageViewModel <InformationViewModel> > {
                    imageViewModel
                },
                SystemErrors = new List <SystemErrorViewModel> {
                    systemErrorViewModel
                },
                Settings = BuildDashboardSettingsViewModel(),
                RedditAuthenticatedUser = redditAuthenticatedUserObjectViewModel,
                RedditSubreddits        = new List <ObjectViewModel <IRedditSubreddit> > {
                    redditSubredditObjectViewModel
                }
            };

            return(new Web.Helpers.ContentHelper(_dataProtectionProviderMock.Object, _httpContextAccessorMock.Object, _urlHelperMock.Object).ToByteArray(dashboardViewModel));
        }
Example #17
0
        public async Task <ActionResult> Edit()
        {
            if (Session["LoginUserName"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            Session["status"] = "Edit Personal Information";
            ViewBag.power     = Session["Power"].ToString();
            InformationViewModel ViewModel = new InformationViewModel();
            var id    = Session["LoginId"].ToString();
            var model = await _informationProvider.GetUser(id);

            ViewModel.number = model.number;
            ViewModel.name   = model.name;
            ViewModel.sex    = model.sex;
            ViewModel.age    = model.age;
            string a     = "[0-9]+";
            Regex  regex = new Regex(a);
            Match  match = regex.Match(model.height);
            Match  Match = regex.Match(model.weight);

            ViewModel.height = match.ToString();
            ViewModel.weight = Match.ToString();
            ViewData["Sex"]  = GetSex();
            return(View(ViewModel));
        }
Example #18
0
        private InformationViewModel GetInformationViewModel()
        {
            var informationViewModel = new InformationViewModel {
                Patient = new InformationPatientViewModel {
                    Id          = 4,
                    Name        = "Vier",
                    FirstName   = "Person",
                    DateOfBirth = new DateTime(2018, 8, 1, 7, 0, 0),
                    Age         = new Age(new DateTime(2018, 8, 1)),
                    Adresse     = "Musterstraße",
                    FileNumber  = 999,
                    Pregnancy   = new PregnancyViewModel {
                        TypPregnancy = TypPregnancy.Prématurité,
                        Month        = 5,
                        Week         = 13,
                        Day          = 7,
                        Position     = TypPosition.Siège
                    },
                    Born = new BornViewModel {
                        BirthWeight         = 3,
                        Cry                 = true,
                        Apgar1mn            = 1,
                        Apgar5mn            = 5,
                        Allaitement         = Allaitement.Exclusif,
                        RemarqueAllaitement = "RemarqueAllaitement"
                    }
                }
            };

            return(informationViewModel);
        }
        public InformationViewModel getInformationViewModel(string name, string passwrd, string select = "", string uname = "")
        {
            //个人信息页面视图模型
            InformationViewModel informationViewModel = new InformationViewModel();

            //用户信息
            UserBusinessLayer userBusinessLayer = new UserBusinessLayer();

            informationViewModel.createUserViewModel      = new CreateUserViewModel();
            informationViewModel.createUserViewModel.user = userBusinessLayer.GetUser(name);//得到当前登录者的用户信息

            //用户是管理者的时候,可以得到所有的用户信息
            if (select != "")
            {
                informationViewModel.users = userBusinessLayer.GetUsers(select, uname);//得到指定条件的人
            }
            else if (informationViewModel.createUserViewModel.user.U_level == level.Admin)
            {
                informationViewModel.users = userBusinessLayer.GetUser();
            }
            else
            {
                informationViewModel.users = new List <User>();
            }
            return(informationViewModel);
        }
Example #20
0
        public async Task AddMember(long userId, long groupId, long memberId)
        {
            var daoGroup = await GetGroupOfUser(userId, groupId);

            if (daoGroup.CreatorUserId != userId)
            {
                throw new ResourceForbiddenException("not_group_creator");
            }

            if (daoGroup.Members.Any(x => x.UserId == memberId))
            {
                throw new BusinessException("user_already_member");
            }

            using (var transaction = Context.Database.BeginTransaction())
            {
                try
                {
                    Context.UsersGroupsMap.Add(new DaoUsersGroupsMap()
                    {
                        UserId  = memberId,
                        GroupId = groupId
                    });

                    await History.LogAddMember(userId, groupId, memberId);

                    if (await Context.SaveChangesAsync() != 2)
                    {
                        throw new DatabaseException("group_member_not_added");
                    }

                    var groupCreator = Context.Users.FirstOrDefault(x => x.Id == userId);
                    var newMember    = Context.Users.FirstOrDefault(x => x.Id == memberId);

                    var model = new InformationViewModel()
                    {
                        Title           = Localizer.GetString(newMember.Lang, LocalizationResource.EMAIL_ADDEDTOGROUP_SUBJECT),
                        PreHeader       = Localizer.GetString(newMember.Lang, LocalizationResource.EMAIL_ADDEDTOGROUP_PREHEADER),
                        Hero            = Localizer.GetString(newMember.Lang, LocalizationResource.EMAIL_ADDEDTOGROUP_HERO),
                        Greeting        = Localizer.GetString(newMember.Lang, LocalizationResource.EMAIL_CASUAL_BODY_GREETING, newMember.DisplayName),
                        Intro           = Localizer.GetString(newMember.Lang, LocalizationResource.EMAIL_ADDEDTOGROUP_BODY_INTRO, groupCreator.DisplayName, daoGroup.Name),
                        EmailDisclaimer = Localizer.GetString(newMember.Lang, LocalizationResource.EMAIL_ADDEDTOGROUP_BODY_DISCLAIMER),
                        Cheers          = Localizer.GetString(newMember.Lang, LocalizationResource.EMAIL_CASUAL_BODY_CHEERS),
                        MShareTeam      = Localizer.GetString(newMember.Lang, LocalizationResource.MSHARE_TEAM),
                        SiteBaseUrl     = $"{UriConf.URIForEndUsers}"
                    };
                    var htmlBody = await Renderer.RenderViewToStringAsync($"/Views/Emails/Confirmation/InformationHtml.cshtml", model);

                    await EmailService.SendMailAsync(MimeKit.Text.TextFormat.Html, newMember.DisplayName, newMember.Email, Localizer.GetString(newMember.Lang, LocalizationResource.EMAIL_ADDEDTOGROUP_SUBJECT), htmlBody);

                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
Example #21
0
        public async Task <IActionResult> Informations([FromRoute] int id)
        {
            var informationViewModel = new InformationViewModel();

            informationViewModel.Patient = await _patientViewModelService.GetPatientWithInformation(id);

            return(View(informationViewModel));
        }
        public ActionResult CodeQr(string txtQRCode)
        {
            ViewBag.txtQRCode = txtQRCode;
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData  = qrGenerator.CreateQrCode(txtQRCode, QRCodeGenerator.ECCLevel.Q);
            QRCode          qrCode      = new QRCode(qrCodeData);

            System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
            imgBarCode.Height = 50;
            imgBarCode.Width  = 50;
            string uniqueId   = Guid.NewGuid().ToString("N");
            string filename   = string.Format("{0}.{1}", uniqueId, "png");
            var    serverpath = Server.MapPath(string.Format("{0}{1}", "~/doc/", filename));

            using (Bitmap bitMap = qrCode.GetGraphic(20))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    using (FileStream fs = new FileStream(serverpath, FileMode.Create, FileAccess.ReadWrite))
                    {
                        bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                        byte[] bytes = ms.ToArray();
                        fs.Write(bytes, 0, bytes.Length);
                        ViewBag.imageBytes = bytes;
                    }
                    //imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                }
            }
            var Ocr = new AdvancedOcr()
            {
                CleanBackgroundNoise             = true,
                EnhanceContrast                  = true,
                EnhanceResolution                = true,
                Language                         = IronOcr.Languages.English.OcrLanguagePack,
                Strategy                         = IronOcr.AdvancedOcr.OcrStrategy.Advanced,
                ColorSpace                       = AdvancedOcr.OcrColorSpace.Color,
                DetectWhiteTextOnDarkBackgrounds = true,
                InputImageType                   = AdvancedOcr.InputTypes.AutoDetect,
                RotateAndStraighten              = true,
                ReadBarCodes                     = true,
                ColorDepth                       = 4
            };
            var testImage = serverpath;
            var Results   = Ocr.Read(testImage);
            var Barcodes  = Results.Barcodes.Select(b => b.Value);

            ViewBag.qrcode = string.Format("Texte : {0} Barcodes: {1}", Results.Text, String.Join(",", Barcodes));
            InformationViewModel informationViewModel = new InformationViewModel()
            {
                CodeQr      = uniqueId,
                Name        = "Stratège Takam",
                CodeQrPath  = filename,
                Title       = "Informations de retrait de la carte national d'idendité",
                Description = "Pour retirer votre coli, vous vous servirai soit du code QR soit du numéro du code "
            };

            return(View(informationViewModel));
        }
Example #23
0
        public async Task UpdatePassword(PasswordUpdate passwordUpdate)
        {
            var daoUser = await GetUser(passwordUpdate.Email);

            var emailToken = daoUser.EmailTokens
                             .FirstOrDefault(x =>
                                             x.Token == passwordUpdate.Token &&
                                             x.TokenType == DaoEmailToken.Type.Password);

            if (emailToken == null || emailToken.ExpirationDate < TimeService.UtcNow)
            {
                throw new ResourceGoneException("token_invalid_or_expired");
            }

            using (var transaction = Context.Database.BeginTransaction())
            {
                try
                {
                    var previousPassword = daoUser.Password;
                    daoUser.Password = Hasher.GetHash(passwordUpdate.Password);

                    if (previousPassword != daoUser.Password && await Context.SaveChangesAsync() != 1)
                    {
                        throw new DatabaseException("password_not_saved");
                    }

                    Context.EmailTokens.Remove(emailToken);

                    if (await Context.SaveChangesAsync() != 1)
                    {
                        throw new DatabaseException("token_deletion_failed");
                    }

                    var model = new InformationViewModel()
                    {
                        Title           = Localizer.GetString(daoUser.Lang, LocalizationResource.EMAIL_PASSWORDCHANGED_SUBJECT),
                        PreHeader       = Localizer.GetString(daoUser.Lang, LocalizationResource.EMAIL_PASSWORDCHANGED_PREHEADER),
                        Hero            = Localizer.GetString(daoUser.Lang, LocalizationResource.EMAIL_PASSWORDCHANGED_HERO),
                        Greeting        = Localizer.GetString(daoUser.Lang, LocalizationResource.EMAIL_CASUAL_BODY_GREETING, daoUser.DisplayName),
                        Intro           = Localizer.GetString(daoUser.Lang, LocalizationResource.EMAIL_PASSWORDCHANGED_BODY_INTRO),
                        EmailDisclaimer = Localizer.GetString(daoUser.Lang, LocalizationResource.EMAIL_PASSWORDCHANGED_BODY_DISCLAIMER),
                        Cheers          = Localizer.GetString(daoUser.Lang, LocalizationResource.EMAIL_CASUAL_BODY_CHEERS),
                        MShareTeam      = Localizer.GetString(daoUser.Lang, LocalizationResource.MSHARE_TEAM),
                        SiteBaseUrl     = $"{UriConf.URIForEndUsers}"
                    };
                    var htmlBody = await Renderer.RenderViewToStringAsync($"/Views/Emails/Confirmation/InformationHtml.cshtml", model);

                    await EmailService.SendMailAsync(MimeKit.Text.TextFormat.Html, daoUser.DisplayName, daoUser.Email, Localizer.GetString(daoUser.Lang, LocalizationResource.EMAIL_PASSWORDCHANGED_SUBJECT), htmlBody);

                    transaction.Commit();
                } catch
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
Example #24
0
        public IActionResult About()
        {
            ViewBag.Username = HttpContext.Session.GetString("username");
            var info = new InformationViewModel {
                InformationalText = "Den här applikationen hanterar skoluppgifter. Man kan skapa uppgifter och hålla koll på dem, samt bocka av dem när de är färdiga."
            };

            return(View(info));
        }
Example #25
0
        /// <summary>
        /// Handles the Click event of the AddInformation control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        void AddInformation_Click(object sender, RoutedEventArgs e)
        {
            InformationViewModel lViewModel = new InformationViewModel("Not", "Information")
            {
                Title = "Pouet pouet"
            };

            lViewModel.Message = "Le Lorem Ipsum est simplement du faux texte employé dans la composition et la mise en page avant impression. Le Lorem Ipsum est le faux texte standard de l'imprimerie depuis les années 1500, quand un peintre anonyme assembla ensemble des morceaux de texte pour réaliser un livre spécimen de polices de texte. Il n'a pas fait que survivre cinq siècles, mais s'est aussi adapté à la bureautique informatique, sans que son contenu n'en soit modifié. Il a été popularisé dans les années 1960 grâce à la vente de feuilles Letraset contenant des passages du Lorem Ipsum, et, plus récemment, par son inclusion dans des applications de mise en page de texte, comme Aldus PageMaker.";
            this.NotifierButton.ViewModel.AddNotification(lViewModel);
        }
        public ActionResult Search(string question)
        {
            var actionresult = default(ActionResult);

            if (!string.IsNullOrEmpty(question))
            {
                var information = new List <InformationViewModel>();

                var key            = default(string);
                var subinformation = default(IEnumerable <object>);

                var warehouseclient = new DataWarehouseClient();
                var diggingresult   = warehouseclient.DigInformation(question);
                foreach (var item in diggingresult)
                {
                    var informationitem = new InformationViewModel();

                    //  Bilder
                    key            = "image";
                    subinformation = item.ContainsKey(key) ? item[key] : default(IEnumerable <object>);
                    if (subinformation != null && subinformation.Any())
                    {
                        informationitem.Images = subinformation.Where(info => !string.IsNullOrEmpty(info.ToString())).Select(info => new Uri(info.ToString()));
                    }

                    //  Titel
                    key            = "title";
                    subinformation = item.ContainsKey(key) ? item[key] : default(IEnumerable <object>);
                    if (subinformation != null && subinformation.Any())
                    {
                        informationitem.Title = subinformation.FirstOrDefault(info => !string.IsNullOrEmpty(info.ToString())) as string;
                    }

                    //  Uri
                    key            = "uri";
                    subinformation = item.ContainsKey(key) ? item[key] : default(IEnumerable <object>);
                    if (subinformation != null && subinformation.Any())
                    {
                        informationitem.Uri = subinformation.Select(info => new Uri(info.ToString())).FirstOrDefault();
                    }

                    information.Add(informationitem);
                }

                actionresult = View(information);
            }
            else
            {
                ViewBag.Message = "Your search page.";

                actionresult = View();
            }

            return(actionresult);
        }
Example #27
0
        public async Task <IActionResult> Information()
        {
            var settings = await _performerSchedulingService.GetSettingsAsync();

            var schedulingStage = _performerSchedulingService.GetSchedulingStage(settings);

            if (schedulingStage != PsSchedulingStage.RegistrationOpen)
            {
                return(RedirectToAction(nameof(Index)));
            }

            var userId    = GetId(ClaimType.UserId);
            var performer = await _performerSchedulingService.GetPerformerByUserIdAsync(userId,
                                                                                        includeBranches : true);

            if (performer?.RegistrationCompleted == false)
            {
                return(RedirectToAction(nameof(Schedule)));
            }

            var systems = await _performerSchedulingService
                          .GetSystemListWithoutExcludedBranchesAsync();

            if (string.IsNullOrEmpty(settings.VendorIdPrompt))
            {
                settings.VendorIdPrompt = "Vendor ID";
            }

            var viewModel = new InformationViewModel
            {
                Performer   = performer,
                Settings    = settings,
                Systems     = systems,
                BranchCount = systems.Sum(_ => _.Branches.Count),
                MaxUploadMB = MaxUploadMB
            };

            if (performer != null)
            {
                if (performer.AllBranches)
                {
                    viewModel.BranchAvailability = systems
                                                   .SelectMany(_ => _.Branches)
                                                   .Select(_ => _.Id)
                                                   .ToList();
                }
                else
                {
                    viewModel.BranchAvailability = performer.Branches?.Select(_ => _.Id).ToList();
                }
            }

            PageTitle = "Performer Information";
            return(View(viewModel));
        }
Example #28
0
        public InformationViewModel GetUserinformation(int userid)
        {
            var user = getuserbyuserid(userid);
            InformationViewModel info = new InformationViewModel();

            info.Email        = user.Email;
            info.RegisterDate = user.RegisterDate;
            info.Username     = user.Username;
            info.Wallet       = balancewallett(user.Username);
            return(info);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TreeWatch.FieldInformationContentPage"/> class.
        /// </summary>
        /// <param name="informationViewModel">Information view model.</param>
        public FieldInformationContentPage(InformationViewModel informationViewModel)
        {
            this.InitializeComponent();

            // set view model
            this.BindingContext = informationViewModel;

            NavigationPage.SetBackButtonTitle(this, informationViewModel.Field.Name);

            varieties.Tapped += (sender, e) => (this.BindingContext as InformationViewModel).NavigateToVarieties();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TreeWatch.BlocksInformationContentPage"/> class.
        /// </summary>
        /// <param name="informationViewModel">Information view model.</param>
        public BlocksInformationContentPage(InformationViewModel informationViewModel)
        {
            this.InitializeComponent();

            // set view model
            this.BindingContext = informationViewModel;

            NavigationPage.SetBackButtonTitle(this, "Blocks");
          
            blockView.ItemTapped += (sender, e) => (this.BindingContext as InformationViewModel).NavigateToBlock();
        }
Example #31
0
        public InformationViewModel getuserinformation(int userid)
        {
            var user = getuserbyid(userid);
            InformationViewModel information = new InformationViewModel();

            information.Email        = user.Email;
            information.UserName     = user.UserName;
            information.Registerdate = user.Registerdate;
            information.Wallet       = Balanceuserwallett(user.UserName);
            return(information);
        }
Example #32
0
        // GET: Worker
        public ActionResult Index()
        {
            ApplicationUser      user        = db.FindUser(User.Identity.GetUserId());
            WorkerIndexViewModel workerIndex = new WorkerIndexViewModel()
            {
                Events         = db.GetEvents(user.Id).Select(e => CalenderViewModel.MapCalenderToCalenderViewModel(e)),
                Information    = db.GetInformation(user.Id).Select(i => InformationViewModel.MapInformation(i)),
                DepartmentName = user.GetDepartmentName()
            };

            return(View(workerIndex));
        }
Example #33
0
 /// <summary>
 /// Insert Register Entity
 /// </summary>
 /// <param name="webModel"></param>
 /// <returns></returns>
 private static Register InsertModel(InformationViewModel webModel)
 {
     return(new Register
     {
         ArriveTime = Convert.ToDateTime(webModel.ArriveTime),
         DateTime = DateTime.Now,
         ExpressId = webModel.ExpressId,
         IsExpress = webModel.IsExpress,
         Place = webModel.Place,
         Remark = webModel.Remark,
         Way = webModel.Way
     });
 }
Example #34
0
 private void EditLanguageComplete(object sender, OriginReference.EditOriginCompletedEventArgs e)
 {
     InformationViewModel informationViewModel = new InformationViewModel();
     if (Convert.ToBoolean(e.Result.ToString()))
         informationViewModel.Message = "The item was edited succesful";
     else
         informationViewModel.Message = "The item was not edited, please try again";
     _informationDialogService.ShowDialog<InformationViewModel>(new InformationWindow(), informationViewModel);
     _originClient.DisplayOriginsAsync();
 }
		public OverviewViewModel(InformationViewModel owner)
		{
			this.Content = owner;
		}
Example #36
0
        /// <summary>
        /// Navigates to field.
        /// </summary>
        /// <param name="field">The field which information should be shown.</param>
        public static void NavigateToField(Field field)
        {
            var navigationPage = (NavigationPage)Application.Current.MainPage;

            var informationViewModel = new InformationViewModel(field);
            navigationPage.PushAsync(new FieldInformationContentPage(informationViewModel));
        }
Example #37
0
        /// <summary>
        /// Maps the tapped.
        /// </summary>
        /// <param name="sender">The sender of the tapped event inside the map.</param>
        /// <param name="e">The arguments of the map tapped event.</param>
        private void MapTapped(object sender, MapTappedEventArgs e)
        {
            var tappedField = this.CheckFieldClicked(e.Position);
            if (tappedField != null)
            {
                this.SelectedField = tappedField;
            }

            if (e.Zoomlevel > 15)
            {
                var tappedBlock = this.CheckBlockClicked(e.Position);
                if (tappedBlock != null)
                {
                    this.selectedBlock = tappedBlock;
                    var navigationPage = (NavigationPage)Application.Current.MainPage;

                    var informationViewModel = new InformationViewModel(this.SelectedField, this.SelectedBlock);
                    navigationPage.PushAsync(new BlockInformationContentPage(informationViewModel));
                }
            }
        }