private void btnSeriesAdd_Click(object sender, EventArgs e) { String strSeries = lstSeries.Text; Series objSeries = new Series(); Utils.CommonMethods cmMethod = new CommonMethods(); if (bookRep.GetSeriesDetails(strSeries).Rows.Count > 0) { MessageBox.Show("Series already present"); return; } objSeries.SeriesName = strSeries; bookRep.InsertSeries(objSeries); lstSeries.DataSource = cmMethod.InitializeList(bookRep.GetSeriesDetails()); lstSeries.DisplayMember = "Seriesname"; lstSeries.ValueMember = "SeriesId"; CommonUIMethods.setLstValue(lstSeries, strSeries); autoSeries.Clear(); foreach (DataRowView dr in lstSeries.Items) autoSeries.Add(dr.Row[1].ToString()); lstSeries.AutoCompleteSource = AutoCompleteSource.CustomSource; lstSeries.AutoCompleteCustomSource = autoSubCategory; }
private void InitializeData(string bookID) { if (gridBooks.RowCount > 0) { lstAuthor.SelectedIndex = 0; lstCategory.SelectedIndex = 0; lstSeries.SelectedIndex = 0; txtMembers.Text = ""; //lstAlphas.SelectedIndex = 0; txtBookId.Text = bookID; tempBookid = txtBookId.Text; DataTable ds = new DataTable(); ds = bookRep.GetBookIDDetails(tempBookid); txtBookName.Text = ds.Rows[0]["BookName"].ToString(); if (transRep.GetTransLoanDetails(tempBookid).Rows.Count > 0) lblBookLendTo.Text = "Book Loaned To:" + transRep.GetTransLoanDetails(tempBookid).Rows[0]["MemberID"].ToString(); else lblBookLendTo.Text = ""; CommonUIMethods.setLstValue(lstAuthor, ds.Rows[0]["Authorname"].ToString()); txtBookPrice.Text = ds.Rows[0]["BookPrice"].ToString(); txtOrgprice.Text = ds.Rows[0]["OrgPrice"].ToString(); CommonUIMethods.setLstValue(lstCategory, ds.Rows[0]["CategoryName"].ToString()); CommonUIMethods.setLstValue(lstSubcat, ds.Rows[0]["Name"].ToString()); CommonUIMethods.setLstValue(lstSeries, ds.Rows[0]["SeriesName"].ToString()); autoAuthors.Clear(); autoSubCategory.Clear(); autoSeries.Clear(); foreach (DataRowView dr in lstAuthor.Items) autoAuthors.Add(dr.Row[1].ToString()); foreach (DataRowView dr in lstSubcat.Items) autoSubCategory.Add(dr.Row[1].ToString()); foreach (DataRowView dr in lstSeries.Items) autoSeries.Add(dr.Row[1].ToString()); lstAuthor.AutoCompleteSource = AutoCompleteSource.CustomSource; lstAuthor.AutoCompleteCustomSource = autoAuthors; lstSubcat.AutoCompleteSource = AutoCompleteSource.CustomSource; lstSubcat.AutoCompleteCustomSource = autoSubCategory; lstSeries.AutoCompleteSource = AutoCompleteSource.CustomSource; lstSeries.AutoCompleteCustomSource = autoSeries; } }