예제 #1
0
        void AddArea()
        {
            if (name_txt.Text == null && login_txt.Text == null && paswd_txt.Text == null && email_txt.Text == null &&
                phone_txt.Text == null && url_txt.Text == null && coments_txt.Text == null)
            {
                MessageBox.Show("All fields is empty", "empty", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (name_txt.Text == null || login_txt.Text == null || paswd_txt.Text == null || email_txt.Text == null ||
                     phone_txt.Text == null || url_txt.Text == null || coments_txt.Text == null)
            {
                MessageBox.Show("Some of field are empty", "empty", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                WorkArea add_wa = new WorkArea
                {
                    SiteName = name_txt.Text,
                    Login    = login_txt.Text,
                    Password = paswd_txt.Text,
                    Email    = email_txt.Text,
                    Phone    = Convert.ToInt32(phone_txt.Text),
                    URL      = url_txt.Text,
                    Coments  = coments_txt.Text,
                };
                add_wa.DateCreate = DateTime.Now;

                //string query = $"insert into WorkAreas_{num}(SiteName, Email, Login, Password, URL, Phone, Coments, DateCreate) " +
                //    $"values({add_wa.SiteName},{add_wa.Email},{add_wa.Login}," +
                //    $"{add_wa.Password},{add_wa.URL},{add_wa.Phone},{add_wa.Coments},'{add_wa.DateCreate}')";
                string msg = Insert.AddWorkArea(add_wa, num);
                MessageBox.Show(msg);
                name_txt.Text = login_txt.Text = paswd_txt.Text = email_txt.Text = url_txt.Text = coments_txt.Text = phone_txt.Text = "";
            }
        }