private void GetBook() { try { objEWA.OrgId = Convert.ToInt32(Session["OrgId"]); ds = objBL.GetBook_BL(objEWA); if (ds.Tables[0].Rows.Count > 0) { GrdBook.DataSource = ds; GrdBook.DataBind(); btnPrint.Visible = true; } else { GrdBook.DataSource = ds; GrdBook.DataBind(); btnPrint.Visible = false; } } catch (Exception ex) { } }
protected void GrdBook_Sorting(object sender, GridViewSortEventArgs e) { List <Book> books = GetData(); books.SortList <Book>(e.SortExpression, e.SortDirection); GrdBook.DataSource = books; GrdBook.DataBind(); }
private void BindGrid() { using (DemoLibraryAppEntities entities = new DemoLibraryAppEntities()) { GrdBook.DataSource = GetData(); GrdBook.DataBind(); } }
protected void GrdBook_PageIndexChanging(object sender, GridViewPageEventArgs e) { try { GrdBook.DataSource = db.Displaygrid("SELECT tblStudent.UserCode, tblLibAddBook.BookName, tblLibAddBook.barcode, tblLibIssueBook.IssueDate, tblLibIssueBook.DueDate, tblLibIssueBook.IssueId FROM tblLibIssueBook INNER JOIN tblLibAddBook ON tblLibIssueBook.BookId = tblLibAddBook.BookId INNER JOIN tblStudent ON tblLibAddBook.OrgId = tblStudent.OrgId AND tblLibIssueBook.StudentId = tblStudent.StudentId WHERE tblLibIssueBook.OrgId = '" + orgId.ToString() + "' ORDER BY tblLibIssueBook.IssueId DESC"); GrdBook.DataBind(); GrdBook.PageIndex = e.NewPageIndex; } catch (Exception ex) { } }
protected void SearchTitle_Click(object sender, EventArgs e) { string title = txtTitle.Text; using (DemoLibraryAppEntities context = new DemoLibraryAppEntities()) { GrdBook.DataSource = (from b in context.Books where b.Title.Contains(title) && b.IsDeleted == 0 select b).ToList(); GrdBook.DataBind(); } }
private void BindGrid() { using (DemoLibraryAppEntities entities = new DemoLibraryAppEntities()) { GrdBook.DataSource = (from book in entities.Books where book.IsDeleted == 0 select book).ToList(); GrdBook.DataBind(); } }
private void BindGrid() { using (DemoLibraryAppEntities entities = new DemoLibraryAppEntities()) { LibraryDB.User currentUser = Session["CurrentUser"] as LibraryDB.User; GrdBook.DataSource = (from t1 in entities.Issues join t2 in entities.Books on t1.BookID equals t2.BookID select new { t1.IssueID, t1.UserID, currentUser.Name, t1.BookID, t2.Title, t2.Author, t1.IssueDate, t1.ReturnDate }).ToList(); GrdBook.DataBind(); } }
private void BindGrid() { using (DemoLibraryAppEntities entities = new DemoLibraryAppEntities()) { LibraryDB.User currentUser = Session["CurrentUser"] as LibraryDB.User; GrdBook.DataSource = (from t1 in entities.Issues join t2 in entities.Books on t1.BookID equals t2.BookID where t1.UserID == currentUser.UserID orderby t1.IssueDate descending select t2).Take(5).ToList(); GrdBook.DataBind(); } }
private void GetIsueeBook() { try { ds = new DataSet(); objBL = new BL_IssueBook(); objEWA.OrgId = Convert.ToInt32(orgId.ToString()); ds = objBL.GetIsueeBook_BL(objEWA); if (ds != null) { GrdBook.DataSource = ds; GrdBook.DataBind(); } GrdBook.EmptyDataText = "Record Not Found "; GrdBook.DataBind(); } catch (Exception ex) { } }
protected void btnSave_Click(object sender, EventArgs e) { try { float b = db.getDb_Value("select BookId from tblLibAddBook where OrgId='" + orgId.ToString() + "'and barcode='" + txtBarcode.Text + "'"); bookid.Text = b.ToString(); //string booknam = db.getDbstatus_Value("select BookName from tblLibAddBook where BookId='" + bookid.Text + "'"); //float a = db.getDb_Value("select StudentId from tblStudent where UserCode='" + txtIssueTo.Text + "' and OrgId='"+orgId.ToString()+"'"); //studid.Text = a.ToString(); string status = db.getDbstatus_Value("select count(*) from tblLibIssueBook where StudentId='" + txtIssueTo.Text + "' and BookId='" + bookid.Text + "'"); if (Convert.ToInt32(status) == 0) { db.cnopen(); db.insert("insert into tblLibIssueBook values('" + txtGroupName.Text + "','" + bookid.Text + "','" + txtIssueTo.Text + "','" + DateTime.Now.Date + "','" + txtDueDate.Text + "','" + orgId.ToString() + "','" + Convert.ToInt32(Session["UserCode"].ToString()) + "','" + System.DateTime.Now.ToString("MM/dd/yyyy") + "','" + "True" + "','" + 1 + "','" + txtBarcode.Text + "')"); float getoldstock = float.Parse(lblstock.Text); float newstock = getoldstock - 1; db.insert("update tblLibAddBook set qty='" + newstock + " ' where BookId ='" + bookid.Text + "' and OrgId='" + Convert.ToInt32(Session["OrgId"]) + "'"); db.cnclose(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Book Issued Successfully')", true); clear(); GrdBook.DataSource = db.Displaygrid("SELECT tblStudent.UserCode, tblLibAddBook.BookName, tblLibAddBook.barcode, tblLibIssueBook.IssueDate, tblLibIssueBook.DueDate, tblLibIssueBook.IssueId FROM tblLibIssueBook INNER JOIN tblLibAddBook ON tblLibIssueBook.BookId = tblLibAddBook.BookId INNER JOIN tblStudent ON tblLibAddBook.OrgId = tblStudent.OrgId AND tblLibIssueBook.StudentId = tblStudent.StudentId WHERE tblLibIssueBook.OrgId = '" + orgId.ToString() + "' ORDER BY tblLibIssueBook.IssueId DESC"); GrdBook.DataBind(); } else if (Convert.ToInt32(status) > 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Book already Issued ')", true); } } catch (Exception ex) { } }