private async void Add_Click(object sender, RoutedEventArgs e)
        {
            Book book = new Book();

            book.BookName       = BookName.Text;
            book.AuthorBook     = AuthorBook.Text;
            book.BookPrice      = double.Parse(BookPrice.Text);
            book.BookCoverImage = await ExtentionMethod.AsByteArray(file);

            db = new BookStoreContext();
            db.Book.Add(book);
            db.SaveChanges();
        }
示例#2
0
        private async void Edit_Click(object sender, RoutedEventArgs e)
        {
            Staff staff = db.Staff.ToList().SingleOrDefault(s => s.StaffID == this.StaffID);

            staff.StaffName   = StaffName.Text;
            staff.Birthday    = BirthdayStaff.Date.DateTime;
            staff.PhoneNumber = PhoneNumber.Text;
            staff.Address     = Address.Text;
            staff.Describe    = Describe.Text;
            staff.Gender      = ((string)MaleRadioButton.Content == "Nam") ? true : false;
            staff.Status      = true;
            staff.ImageStaff  = await ExtentionMethod.AsByteArray(file);

            db.SaveChanges();
        }
示例#3
0
        public void SendSMS(int userID)
        {
            var account = _accountRepository.GetForID(userID);

            foreach (var relationship in account.UserRelationship)
            {
                var phone = relationship.Phone;
                if (phone.Length > 0 && phone[0] == '0')
                {
                    phone = phone.Remove(0, 1);
                    ExtentionMethod.SendSMS(string.Format("{0}{1}", "+84", phone),
                                            String.Format("{0} has {1} heart beat. Please call emergency!", account.FullName, "150"));
                }
            }
            //ExtentionMethod.SendSMS("+84965198634", "testsms");
        }
示例#4
0
        private async void Add_Click(object sender, RoutedEventArgs e)
        {
            Staff staff = new Staff();

            staff.StaffName   = StaffName.Text;
            staff.Birthday    = BirthdayStaff.Date.DateTime;
            staff.PhoneNumber = PhoneNumber.Text;
            staff.Address     = Address.Text;
            staff.Describe    = Describe.Text;
            staff.Gender      = ((string)MaleRadioButton.Content == "Nam") ? true : false;
            staff.Status      = true;
            staff.ImageStaff  = await ExtentionMethod.AsByteArray(file);

            db = new BookStoreManagementData.BookStoreContext();
            db.Staff.Add(staff);
            db.SaveChanges();
        }