private string createBiGFriends(string result)
        {
            FRIENDS item          = DATA._FRIENDS.Last();
            string  i1            = item.mainImg;
            string  sname         = DATA.imageDict[i1];
            string  imglistprefix = "data\\friends";

            result = result.Replace("$friendimagelink", imglistprefix + "\\" + item.Id + ".html");
            result = result.Replace("$frienddate", item.date.ToString("yyyy-MM-dd"));

            result = result.Replace("$friendimagesrc", imglistprefix + "\\" + item.Id + "\\" + i1);

            string texts = string.Join("<br> <br>", item.txtContents.ToArray());

            result = result.Replace("$frindDigText", texts);
            return(result);
        }
        public ActionResult Zapros(string userID)
        {
            var db     = new ProjektEntities();
            var friend = from i in db.FRIENDS
                         where i.User_ID == User.Identity.Name
                         join us in db.USER
                         on i.Friend_ID equals us.User_ID
                         where us.Is_Exists == true
                         select new { us.User_ID, us.Image };

            var mod = new FriendsListView
            {
                ListFriends = new List <FriendsView>(),
                ListSearch  = new List <FriendsView>()
            };

            foreach (var x in friend)
            {
                mod.ListFriends.Add(new FriendsView {
                    UserID = x.User_ID, imageData = x.Image
                });
            }

            USER user = db.USER.Find(userID);


            /*  INVITATIONS invitation = new INVITATIONS();
             * invitation.Accept = false;
             * invitation.From_ID = User.Identity.Name;
             * invitation.To_ID = userID;
             * db.INVITATIONS.Add(invitation);*/

            FRIENDS newFriend = new FRIENDS();

            newFriend.Friend_ID = userID;
            newFriend.User_ID   = User.Identity.Name;
            db.FRIENDS.Add(newFriend);
            db.SaveChanges();
            newFriend.User_ID   = userID;
            newFriend.Friend_ID = User.Identity.Name;
            db.FRIENDS.Add(newFriend);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemple #3
0
        private CONTENT getContent(String path, string _type)
        {
            CONTENT content = new CONTENT();


            switch (_type)
            {
            case "DOGANDCAT":
                content = new DOGANDCAT();
                break;

            case "FRIENDS":
                content = new FRIENDS();
                break;

            case "SPORT":
                content = new SPORT();
                break;

            case "WORKOUT":
                content = new WORKOUT();
                break;

            case "FOOD":
                content = new FOOD();
                break;

            case "BOOK":
                content = new BOOK();
                break;

            default:
                Console.WriteLine("WRONG TYPE!!!");
                break;
            }

            String[] ll = path.Split(new string[] { "\\" }, StringSplitOptions.None);
            string   si = ll.Last();

            content.Id             = Convert.ToInt32(si);
            content.dataFolderPath = path;
            content.parse();
            return(content);
        }
Exemple #4
0
        private static void AddFriends(List<User> FriendsToAdd, User usr)
        {
            using (elmatEntities entities = new elmatEntities())
            {
                try {
                    foreach (User fr in FriendsToAdd)
                    {
                        FRIENDS f = new FRIENDS();
                        f.UserID_A = usr.UserID;
                        f.UserID_B = fr.UserID;
                        f.StatusID = 1;

                        entities.FRIENDS.Add(f);
                    }
                    entities.SaveChanges();
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }