Exemplo n.º 1
0
        public static List <Pogovor> GetHistory()
        {
            DataTable data = new DataTable();

            using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["servicechatConnectionString"].ConnectionString))
            {
                string cmd = "Select * from Pogovor";

                connection.Open();
                using (SqlCommand command = new SqlCommand(cmd, connection))
                {
                    //command.Parameters.Add(new SqlParameter("username", username));
                    using (SqlDataAdapter da = new SqlDataAdapter(command))
                    {
                        da.Fill(data);
                    }
                }

                connection.Close();
            }

            List <Pogovor> p_list = new List <Pogovor>();

            foreach (DataRow row in data.Rows)
            {
                Pogovor p = new Pogovor(row);
                p_list.Add(p);
            }


            return(p_list);
        }
Exemplo n.º 2
0
        protected void PostaneAdmin_Click(object sender, EventArgs e)
        {
            String  adminUsername = UsersToEdit.SelectedItem.ToString();
            Pogovor p             = new Pogovor();

            p.userAdmin(adminUsername);
        }
Exemplo n.º 3
0
        protected void Izbriši_Click(object sender, EventArgs e)
        {
            String  deleteUsername = UsersToEdit.SelectedItem.ToString();
            Pogovor p = new Pogovor();

            p.DeleteUserChat(deleteUsername);
            p.DeleteUser(deleteUsername);

            // ta koda se nj še izvede da bo tut vidt da je uporabnik zbrisan
            //Users.Items.Clear();
            //Users.allUsers();
        }
Exemplo n.º 4
0
        public void Send(string username, string message)
        {
            if (AuthenticateUser() == true)
            {
                var timeZone = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time");

                Pogovor p = new Pogovor();
                p.besedilo = message;
                p.username = username;
                p.cas      = "krnekj";

                p.Persist();
            }
            else
            {
                //Something is wrong
            }
        }
Exemplo n.º 5
0
        protected void Send_Click(object sender, EventArgs e)
        {
            var    timeZone = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time");
            string besedilo = Message.Text;

            Message.Text = "";

            Pogovor p = new Pogovor();

            p.besedilo = besedilo;
            p.username = CurrentUser.Text;
            p.cas      = TimeZoneInfo.ConvertTime(DateTime.Now, timeZone).ToString("HH:mm:ss");

            p.Persist();

            //string dodaj = (Userdata)Session["userdata"] + ":" + besedilo;

            //Messages.Items.Add(p.ToDataRow());
            Refresh_Click(null, null);
            //history.Add(dodaj);
        }