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(); }
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(); }
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"); }
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(); }