Esempio n. 1
0
        private async void ExecuteGetPhotos(object obj)
        {
            IsEnforce = false;

            UserDatum      selectedDataum = NameSuggests.FirstOrDefault <UserDatum>(x => x.username == Name);
            UserAttributes t;

            SetHeaderAttributes(true, String.Format("Собираем фотографии пользователя {0}", Name));
            if (selectedDataum != null)
            {
                t = await _dataService.getUserAttributes(selectedDataum.id);

                if (t != null && t.data != null)
                {
                    UserPics.Clear();
                    foreach (var item in t.data)
                    {
                        UserPics.Add(item);
                    }
                    IsEnforce = true;
                    SetHeaderAttributes(false, String.Empty);
                    IsVisiblePreviousButton = true;
                }
            }
            else
            {
                IsVisiblePreviousButton = false;
                SetHeaderAttributes(false, String.Format("Не удалось загрузить пользователя {0}", Name));
            }
        }
Esempio n. 2
0
        public string InsertUserProfilePics(string conn, UserPics userPics)
        {
            string    msg       = string.Empty;
            SqlHelper sqlHelper = new SqlHelper(conn);
            var       para      = new DynamicParameters();
            var       outPut    = new DynamicParameters();

            try
            {
                para.Add("@UserEmail_ID", userPics.emailId);
                para.Add("@PicName", userPics.PicName);
                para.Add("@PicFilePath", userPics.PicFilePath);
                if (userPics.IsProfilePic)
                {
                    para.Add("@IsProfilePic", 1);
                }
                else
                {
                    para.Add("@IsProfilePic", 0);
                }
                para.Add("@CREATED_BY", userPics.emailId);
            }
            catch (Exception exp)
            {
                msg = "Error :" + exp.Message;
            }
            try
            {
                var getUserPics = GetUserPics(conn, userPics.emailId);

                if (getUserPics.Count() >= 5) // maximum 5 pics can be uploaded
                {
                    msg = "You cannot insert more then 5 pics.";
                    return(msg);
                }

                else
                {   //lamda to check the profile pic
                    var userpics = getUserPics.Where(c => c.IsProfilePic.ToUpper() == "TRUE".ToUpper()).ToList();
                    if (userpics.Count() >= 1)
                    {
                        msg = "You have already set the Profile Pic. Please uncheck the the profile pic status.";
                        return(msg);
                    }
                    else
                    {
                        var result = sqlHelper.ExecuteSpReturnMessage("InsertUserPics", para, null, true, null);
                        msg = "Successfully Inserted Pics.";
                    }
                }
            }
            catch (Exception exp)
            {
                msg = "Error :" + exp.Message;
            }
            //int valueout = para.Get<int>("@outresult");
            return(msg);
        }
Esempio n. 3
0
        public string FileUploadData(UserPics userPics)
        {
            var              data       = userPics;
            string           con        = ConfigurationManager.ConnectionStrings["SqlServerConnString"].ConnectionString;
            Crud_UserProfile repository = new Crud_UserProfile();

            return(repository.InsertUserProfilePics(con, data));
            //InsertUserProfilePics
        }
Esempio n. 4
0
        public HttpResponseMessage UploadJsonFile(UserPics userPics)
        {
            HttpResponseMessage response = new HttpResponseMessage();
            var httpRequest = HttpContext.Current.Request;

            if (httpRequest.Files.Count > 0)
            {
                foreach (string file in httpRequest.Files)
                {
                    var postedFile = httpRequest.Files[file];
                    var filePath   = HttpContext.Current.Server.MapPath("~/UploadFile/" + postedFile.FileName);
                    postedFile.SaveAs(filePath);
                }
            }
            return(response);
        }