Esempio n. 1
0
        public void SetData(string messageset, string listfriend)
        {
            MessangerDatabaseEntities contex = new MessangerDatabaseEntities();
            //var c = contex.LoginData.First(x => x.Id == listfriend);
            var message = new MessageDataLoad
            {
                Message   = messageset,
                LoginData = l
            };

            contex.MessageDataLoad.Add(message);
            contex.SaveChanges();
            messange    = contex.MessageDataLoad.ToList();
            messagedata = messange.Select(x => x.Message).ToArray();
            SetDataToWindow();
        }
Esempio n. 2
0
        public void Login(string login, string pass)
        {
            MessangerDatabaseEntities contex = new MessangerDatabaseEntities();
            var log = new LoginData
            {
                LogName = login,
                Pass    = pass
            };

            l = log;
            contex.LoginData.Add(log);
            contex.SaveChanges();
            loging     = contex.LoginData.ToList();
            listfriend = loging.Select(x => new { x.LogName, x.Pass }).ToArray();
            SetDataToWindowUser();
        }
Esempio n. 3
0
        public int LoadFileStream(string filename)
        {
            MessangerDatabaseEntities contex = new MessangerDatabaseEntities();
            FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);

            MyData = new byte[fs.Length];

            using (var reader = new BinaryReader(fs))
            {
                MyData = reader.ReadBytes((int)fs.Length);
            }

            var dataset = new DataDbLoadFile
            {
                DataFile = MyData
            };

            contex.DataDbLoadFile.Add(dataset);
            contex.SaveChanges();
            int data = MyData.Length;

            return(data);
        }