Ejemplo n.º 1
0
        public bool UpdateMember(member UpdatedMember)
        {
            var before       = dbs.member.FirstOrDefault(m => m.MemberID == UpdatedMember.MemberID);
            var rowsAffected = dbs.Database.ExecuteSqlCommand("update [dbo].[member] " +
                                                              "set FirstName = '" + UpdatedMember.FirstName +
                                                              "', LastName = '" + UpdatedMember.LastName +
                                                              "', Phone = '" + UpdatedMember.Phone +
                                                              "', email = '" + UpdatedMember.Email +
                                                              "', Address = '" + UpdatedMember.Address +
                                                              "', City = '" + UpdatedMember.City +
                                                              "', State = '" + UpdatedMember.State +
                                                              "', Zip = '" + UpdatedMember.Zip +
                                                              "' WHERE [MemberID]={0}", UpdatedMember.MemberID);

            return(rowsAffected > 0);
        }
Ejemplo n.º 2
0
        private void UpdateBtn_Click(object sender, RoutedEventArgs e)
        {
            var UpdatedMember = new member();

            UpdatedMember.MemberID  = Convert.ToInt32(IDTextBox.Text);
            UpdatedMember.FirstName = FirstNameTextbox.Text;
            UpdatedMember.LastName  = LastNameTextbox.Text;
            UpdatedMember.Phone     = PhoneTextBox.Text;
            UpdatedMember.Email     = EmailTextbox.Text;
            UpdatedMember.Address   = AddressTextBox.Text;
            UpdatedMember.City      = CityTextBox.Text;
            UpdatedMember.State     = StateTextBox.Text;
            UpdatedMember.Zip       = ZipTextBox.Text;

            if (_memberFuncs.UpdateMember(UpdatedMember))
            {
                MessageBox.Show("Member Updated.");
                this.Close();
            }
            else
            {
                MessageBox.Show("Error Updating Member.");
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //Check the fields
            if (string.IsNullOrEmpty(FirstNameTextbox.Text))
            {
                FirstNameTextbox.BorderBrush = System.Windows.Media.Brushes.Red;
                return;
            }
            if (string.IsNullOrEmpty(LastNameTextbox.Text))
            {
                LastNameTextbox.BorderBrush = System.Windows.Media.Brushes.Red;
                return;
            }
            if (string.IsNullOrEmpty(PhoneTextBox.Text))
            {
                PhoneTextBox.BorderBrush = System.Windows.Media.Brushes.Red;
                return;
            }
            if (string.IsNullOrEmpty(EmailTextbox.Text))
            {
                EmailTextbox.BorderBrush = System.Windows.Media.Brushes.Red;
                return;
            }
            if (string.IsNullOrEmpty(AddressTextBox.Text))
            {
                AddressTextBox.BorderBrush = System.Windows.Media.Brushes.Red;
                return;
            }
            if (string.IsNullOrEmpty(CityTextBox.Text))
            {
                CityTextBox.BorderBrush = System.Windows.Media.Brushes.Red;
                return;
            }
            if (string.IsNullOrEmpty(StateTextBox.Text))
            {
                StateTextBox.BorderBrush = System.Windows.Media.Brushes.Red;
                return;
            }
            if (string.IsNullOrEmpty(ZipTextBox.Text))
            {
                ZipTextBox.BorderBrush = System.Windows.Media.Brushes.Red;
                return;
            }

            //Create member entity

            var newMember = new member();

            newMember.FirstName = FirstNameTextbox.Text;
            newMember.LastName  = LastNameTextbox.Text;
            newMember.Phone     = PhoneTextBox.Text;
            newMember.Email     = EmailTextbox.Text;
            newMember.Address   = AddressTextBox.Text;
            newMember.City      = CityTextBox.Text;
            newMember.State     = StateTextBox.Text;
            newMember.Zip       = ZipTextBox.Text;
            newMember.Status    = "OK";

            //Add The member to the database
            if (memberFuncs.InsertMember(newMember))
            {
                MessageBox.Show("Member Created.");
                this.Close();
            }
            else
            {
                MessageBox.Show("Error Creating Member.");
            }
        }
Ejemplo n.º 4
0
        public bool DeleteMember(member member)
        {
            var rowsAffected = dbs.Database.ExecuteSqlCommand("DELETE FROM [dbo].[member] WHERE [MemberID]={0}", member.MemberID);

            return(rowsAffected > 0);
        }
Ejemplo n.º 5
0
 public bool InsertMember(member newMember)
 {
     dbs.member.Add(newMember);
     return(dbs.SaveChanges() > 0);
 }
Ejemplo n.º 6
0
 private List <bill_info> GetAPPeriodBill_infoByMember(member singleMember)
 {
     return(dbs.bill_info.Where(m => m.ServiceDate <= today && m.ServiceDate >= lastWeek &&
                                m.MemberID == singleMember.MemberID)
            .ToList());
 }