Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="groupImage"></param>
        public void DeleteGroupImage(GroupImage groupImage)
        {
            var entity = _context.GroupImage.FirstOrDefault(gi => gi.GroupId == groupImage.GroupId);

            if (entity != null)
            {
                _context.GroupImage.Remove(groupImage);
                _context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="groupImage"></param>
        public void AddGroupImage(GroupImage groupImage)
        {
            var entity = _context.GroupImage.FirstOrDefault(gi => gi.GroupId == groupImage.GroupId);

            if (entity == null)
            {
                _context.GroupImage.Add(groupImage);
                _context.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        public ClassInfoOutput AddPhoto([FromBody] ClassInfoInput input)
        {
            ClassInfoOutput output = new ClassInfoOutput();

            if (input == null)
            {
                Response.StatusCode = 400;
                output.Result       = "INPUT_IS_NULL";
            }
            else
            {
                AspUserService aspUser    = new AspUserService(_db, this);
                Recognizer     recognizer = _db.Recognizers.Where(e => e.Id.Equals(input.RecognizerId) && e.Deleted == false).FirstOrDefault();
                if (recognizer == null)
                {
                    Response.StatusCode = 400;
                    output.Result       = "RECOGNIZER_NOT_EXIST";
                }
                else
                {
                    if (recognizer.Key.Equals(input.RecognizerKey))
                    {
                        Class thisClass = _db.Classes.Where(e => e.Id.Equals(input.ClassId) && e.Deleted == false).FirstOrDefault();
                        if (thisClass == null)
                        {
                            Response.StatusCode = 400;
                            output.Result       = "CLASS_NOT_EXIST";
                        }
                        else
                        {
                            GroupImage gi = new GroupImage
                            {
                                Url       = input.ImageUrl,
                                Class     = thisClass,
                                CreatedBy = recognizer.Id,
                                Status    = 1
                            };

                            _db.GroupImages.Add(gi);
                            _db.SaveChanges();
                            output.Result = "OK";
                        }
                    }
                    else
                    {
                        Response.StatusCode = 400;
                        output.Result       = "CREDENTIAL_ERROR";
                    }
                }
            }

            return(output);
        }
Ejemplo n.º 4
0
        public IActionResult UploadImage(IFormCollection files)
        {
            string temp = files["groupId"];

            int.TryParse(temp, out int id);

            IFormFile uploadedImage;

            try
            {
                uploadedImage = files.Files[0];

                if (uploadedImage.ContentType.ToLower().StartsWith("image/") && uploadedImage != null)
                {
                    MemoryStream ms = new MemoryStream();
                    uploadedImage.OpenReadStream().CopyTo(ms);

                    Image image = Image.FromStream(ms);

                    GroupImage imageEntity = new GroupImage
                    {
                        FileName    = uploadedImage.Name,
                        Data        = ms.ToArray(),
                        Width       = image.Width,
                        Height      = image.Height,
                        ContentType = uploadedImage.ContentType,
                        GroupId     = id
                    };

                    GroupImage item = groupImageService.GetByGroupId(id);

                    if (item != null)
                    {
                        //imageEntity.UserImageId = item.UserImageId;

                        groupImageService.UpdateGroupImage(imageEntity);
                    }

                    else
                    {
                        groupImageService.AddGroupImage(imageEntity);
                    }
                }
            }

            catch
            {
            }

            return(Ok());
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="groupImage"></param>
        public void UpdateGroupImage(GroupImage groupImage)
        {
            var entity = _context.GroupImage.FirstOrDefault(gi => gi.GroupId == groupImage.GroupId);

            if (entity != null)
            {
                entity.FileName    = groupImage.FileName;
                entity.Data        = groupImage.Data;
                entity.Width       = groupImage.Width;
                entity.Height      = groupImage.Height;
                entity.ContentType = groupImage.ContentType;

                _context.GroupImage.Update(entity);
                _context.SaveChanges();
            }
        }
Ejemplo n.º 6
0
        void ReleaseDesignerOutlets()
        {
            if (CreateGroupButton != null)
            {
                CreateGroupButton.Dispose();
                CreateGroupButton = null;
            }

            if (GroupImage != null)
            {
                GroupImage.Dispose();
                GroupImage = null;
            }

            if (GroupSubject != null)
            {
                GroupSubject.Dispose();
                GroupSubject = null;
            }
        }
Ejemplo n.º 7
0
 public void Destroy( )
 {
     // free image resources for Android's sake.
     FamilyImage.Destroy( );
     GroupImage.Destroy( );
 }
Ejemplo n.º 8
0
        public void Create(object masterView, RectangleF frame, OnButtonClick onJoinClicked)
        {
            OnButtonClicked = onJoinClicked;

            View = PlatformView.Create( );
            View.BackgroundColor = ControlStylingConfig.BackgroundColor;
            View.AddAsSubview(masterView);

            // Group Title
            GroupTitle = PlatformLabel.Create( );
            GroupTitle.AddAsSubview(masterView);
            GroupTitle.SetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Large_FontSize);
            GroupTitle.TextColor     = ControlStylingConfig.TextField_ActiveTextColor;
            GroupTitle.TextAlignment = TextAlignment.Center;

            // Meeting Time
            MeetingTime = PlatformLabel.Create( );
            MeetingTime.AddAsSubview(masterView);
            MeetingTime.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize);
            MeetingTime.TextColor     = ControlStylingConfig.TextField_ActiveTextColor;
            MeetingTime.TextAlignment = TextAlignment.Center;

            // Childcare Provided
            ChildcareProvided = PlatformLabel.Create( );
            ChildcareProvided.AddAsSubview(masterView);
            ChildcareProvided.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize);
            ChildcareProvided.TextColor     = ControlStylingConfig.TextField_ActiveTextColor;
            ChildcareProvided.TextAlignment = TextAlignment.Center;

            // Young Adults
            YoungAdults = PlatformLabel.Create( );
            YoungAdults.AddAsSubview(masterView);
            YoungAdults.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize);
            YoungAdults.TextColor     = ControlStylingConfig.TextField_ActiveTextColor;
            YoungAdults.TextAlignment = TextAlignment.Center;



            // Family Image and Layer
            FamilyImageLayer = PlatformView.Create( );
            FamilyImageLayer.AddAsSubview(masterView);
            FamilyImageLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color;
            FamilyImageLayer.BorderColor     = ControlStylingConfig.BG_Layer_BorderColor;
            FamilyImageLayer.BorderWidth     = ControlStylingConfig.BG_Layer_BorderWidth;

            FamilyImage = PlatformImageView.Create( );
            FamilyImage.AddAsSubview(masterView);
            FamilyImage.ImageScaleType  = PlatformImageView.ScaleType.ScaleAspectFit;
            FamilyImage.BackgroundColor = 0;


            // Group Desc
            GroupDescLayer = PlatformView.Create( );
            GroupDescLayer.AddAsSubview(masterView);
            GroupDescLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color;
            GroupDescLayer.BorderColor     = ControlStylingConfig.BG_Layer_BorderColor;
            GroupDescLayer.BorderWidth     = ControlStylingConfig.BG_Layer_BorderWidth;

            GroupDesc = PlatformLabel.Create( );
            GroupDesc.AddAsSubview(masterView);
            GroupDesc.TextAlignment = TextAlignment.Center;
            GroupDesc.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize);
            GroupDesc.TextColor = ControlStylingConfig.TextField_ActiveTextColor;

            // Group Desc Header
            GroupDescHeader = PlatformLabel.Create( );
            GroupDescHeader.AddAsSubview(masterView);
            GroupDescHeader.TextAlignment = TextAlignment.Center;
            GroupDescHeader.SetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Medium_FontSize);
            GroupDescHeader.TextColor = ControlStylingConfig.TextField_ActiveTextColor;
            GroupDescHeader.Text      = ConnectStrings.GroupInfo_AboutGroup;


            // Childcare Desc
            ChildDescLayer = PlatformView.Create( );
            ChildDescLayer.AddAsSubview(masterView);
            ChildDescLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color;
            ChildDescLayer.BorderColor     = ControlStylingConfig.BG_Layer_BorderColor;
            ChildDescLayer.BorderWidth     = ControlStylingConfig.BG_Layer_BorderWidth;

            ChildDesc = PlatformLabel.Create( );
            ChildDesc.AddAsSubview(masterView);
            ChildDesc.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize);
            ChildDesc.TextColor     = ControlStylingConfig.TextField_ActiveTextColor;
            ChildDesc.TextAlignment = TextAlignment.Center;

            // Child Desc Header
            ChildDescHeader = PlatformLabel.Create( );
            ChildDescHeader.AddAsSubview(masterView);
            ChildDescHeader.TextAlignment = TextAlignment.Center;
            ChildDescHeader.SetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Medium_FontSize);
            ChildDescHeader.TextColor = ControlStylingConfig.TextField_ActiveTextColor;
            ChildDescHeader.Text      = ConnectStrings.GroupInfo_AboutChildcare;


            // Group Image and Layer
            GroupImageLayer = PlatformView.Create( );
            GroupImageLayer.AddAsSubview(masterView);
            GroupImageLayer.BackgroundColor = ControlStylingConfig.BG_Layer_Color;
            GroupImageLayer.BorderColor     = ControlStylingConfig.BG_Layer_BorderColor;
            GroupImageLayer.BorderWidth     = ControlStylingConfig.BG_Layer_BorderWidth;

            GroupImage = PlatformImageView.Create( );
            GroupImage.AddAsSubview(masterView);
            GroupImage.ImageScaleType  = PlatformImageView.ScaleType.ScaleAspectFit;
            GroupImage.BackgroundColor = 0;


            // Join Button
            JoinButton = PlatformButton.Create( );
            JoinButton.AddAsSubview(masterView);
            JoinButton.ClickEvent      = JoinClicked;
            JoinButton.BackgroundColor = ControlStylingConfig.Button_BGColor;
            JoinButton.TextColor       = ControlStylingConfig.Button_TextColor;
            JoinButton.CornerRadius    = ControlStylingConfig.Button_CornerRadius;
            JoinButton.Text            = ConnectStrings.JoinGroup_JoinButtonLabel;
            JoinButton.SizeToFit( );
            JoinButton.UserInteractionEnabled = true;

            // Create our results view overlay
            ResultView = new UIResultView(masterView, View.Frame, OnResultViewDone);

            // Create our blocker view
            BlockerView = new UIBlockerView(masterView, View.Frame);
        }