private void btnClear_Click_1(object sender, EventArgs e) { txtISBN.Text = ""; txtName.Text = ""; txtPrice.Text = ""; txtQuantity.Text = ""; txtDesc.Text = ""; txtPrice.Text = ""; txtStatus.Text = ""; ListAuthors.ClearSelected(); ListCategory.ClearSelected(); cboPublisher.SelectedIndex = 0; }
private void AddBook_Load(object sender, EventArgs e) { ListAuthors.DataSource = proxy.GetAllBookAuthor(); ListAuthors.DisplayMember = "Name"; ListAuthors.ValueMember = "Id"; ListCategory.DataSource = proxy.GetBookAllCategory(); ListCategory.DisplayMember = "name"; ListCategory.ValueMember = "Id"; ListCategory.SelectionMode = SelectionMode.MultiExtended; ListAuthors.SelectionMode = SelectionMode.MultiExtended; publishYearPicker.Format = DateTimePickerFormat.Custom; publishYearPicker.CustomFormat = "yyyy"; publishYearPicker.ShowUpDown = true; cboPublisher.DataSource = proxy.getAllPublisher(); cboPublisher.DisplayMember = "name"; cboPublisher.ValueMember = "id"; ListAuthors.ClearSelected(); }
private void UpdateBook_Load(object sender, EventArgs e) { txtISBN.Text = book.ISBN; txtName.Text = book.Name; txtPrice.Text = book.Price.ToString(); txtQuantity.Text = book.Quantity.ToString(); txtDesc.Text = book.Description; txtPrice.Text = book.Price.ToString(); txtStatus.Text = book.Status; for (int i = 0; i < ListAuthors.Items.Count; i++) { int count = 0; for (int t = count; t < book.Author.Count; t++) { if (book.Author[t].ID == ((AuthorData)ListAuthors.Items[i]).ID) { ListAuthors.SetSelected(i, true); count = t; break; } } } for (int i = 0; i < ListCategory.Items.Count; i++) { for (int t = 0; t < book.Category.Count; t++) { if (((CategoryData)ListCategory.Items[i]).ID == book.Category[t].ID) { ListCategory.SetSelected(i, true); break; } } } for (int i = 0; i < cboPublisher.Items.Count; i++) { if (book.Publisher_ID == ((PublisherData)cboPublisher.Items[i]).ID) { cboPublisher.SelectedIndex = i; } } }
public UpdateBook(int ID) { InitializeComponent(); ChannelFactory <IBussinessLogic> chanel = new ChannelFactory <IBussinessLogic>("ClientEndPoint"); proxy = chanel.CreateChannel(); book = proxy.GetBookDataByID(ID); ListAuthors.DataSource = proxy.GetAllBookAuthor(); ListAuthors.DisplayMember = "name"; ListAuthors.ValueMember = "id"; ListCategory.DataSource = proxy.GetBookAllCategory(); ListCategory.DisplayMember = "name"; ListCategory.ValueMember = "id"; cboPublisher.DataSource = proxy.getAllPublisher(); cboPublisher.DisplayMember = "name"; cboPublisher.ValueMember = "id"; ListAuthors.ClearSelected(); ListCategory.ClearSelected(); ListAuthors.SelectionMode = SelectionMode.MultiExtended; ListCategory.SelectionMode = SelectionMode.MultiExtended; this.MaximizeBox = false; this.MinimizeBox = false; }