protected void firstButton_Click(object sender, EventArgs e) { BookReturn bookReturn = bookReturnManager.GetReturns(0); GetData(bookReturn); Session["active"] = 0; }
public string Save(BookReturn bookReturn) { if (bookReturnGateway.Insert(bookReturn) > 0) { return("Saved Successfully!!"); } return("Could Not Save data in Database!!"); }
public async Task <object> GetAsync(BookReturn parameters) { vReturnBook vReturnBook = new vReturnBook(); return(await Uow.Repository <vReturnBook>().AllAsync()); //throw new NotImplementedException(); }
protected void lastButton_Click(object sender, EventArgs e) { List <BookReturn> bookReturnList = (List <BookReturn>)(Session["bookReturn"]); int x = bookReturnList.Count - 1; BookReturn bookReturn = bookReturnManager.GetReturns(x); GetData(bookReturn); Session["active"] = x; }
public BookReturn ReturnBook(BookReturn bookReturn) { var returnBook = _libraryContext.Add(bookReturn); bookReturn.BookId = returnBook.Entity.BookId; bookReturn.Barcode = returnBook.Entity.Barcode; bookReturn.StudentId = returnBook.Entity.StudentId; bookReturn.BookReturingDate = returnBook.Entity.BookReturingDate.AddDays(7); ContextSaveChanges(_libraryContext); return(bookReturn); }
public double CheckFine(BookReturn bookReturn, BookIssue bookIssue, Student student) { var returnBook = _reportRepository.ReturnBook(bookReturn); var timeSpan = bookIssue.BookIssueDate - returnBook.BookReturingDate; var fine = student.FineAmount; if (timeSpan.Days > 7) { fine *= 10; } return(fine); }
public List <BookReturn> SearchByUserName(string username) { List <BookReturn> list = new List <BookReturn>(); string sql = "SELECT rent.*, re.*, a.UserName AS 'Customer', a2.UserName AS 'Employee', b.Name FROM dbo.BookReturn AS re INNER JOIN dbo.BookRental AS rent ON re.IdBookRental = rent.Id INNER JOIN dbo.Account AS a ON a.Id = rent.IdAccount INNER JOIN dbo.Account AS a2 ON a2.Id = re.IdEmployeeAccount INNER JOIN dbo.Book AS b ON b.Id = rent.IdBook WHERE UserName like N'%" + username + "%'"; DataTable data = DataProvider.Instance.ExecuteQuery(sql); foreach (DataRow item in data.Rows) { BookReturn book = new BookReturn(item); list.Add(book); } return(list); }
private void BindReturn(string strSerialNo) { string strsql = "select * from tbBookReturn where cnnBookID=" + strSerialNo + " order by cnnSerialNo desc"; DataTable dt = Helper.Query(strsql); lblReturn.Text = ""; foreach (DataRow dr in dt.Rows) { Entity.BookReturn br = new BookReturn(dr); lblReturn.Text += "<hr>"; lblReturn.Text += "<p class='bookreturn'>" + br.cnvcReturn + "</p>"; lblReturn.Text += "<p class='bookoper'>" + br.cnvcReturnName + "</p>"; lblReturn.Text += "<p class='bookdate'>" + br.cndReturnDate.ToString("yyyy-MM-dd hh:mm:ss") + "</p>"; lblReturn.Text += "<hr>"; } }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } BookReturn = await _context.BookReturn .Include(b => b.bookRent).FirstOrDefaultAsync(m => m.Id == id); if (BookReturn == null) { return(NotFound()); } return(Page()); }
protected void nextButton_Click(object sender, EventArgs e) { int active = (int)Session["active"]; active++; List <BookReturn> bookReturnList = (List <BookReturn>)(Session["bookReturn"]); if (active >= bookReturnList.Count) { active = 0; } BookReturn bookReturn = bookReturnManager.GetReturns(active); GetData(bookReturn); Session["active"] = active; }
protected void previousButton_Click(object sender, EventArgs e) { int active = (int)Session["active"]; active--; List <BookReturn> bookReturnList = (List <BookReturn>)(Session["bookReturn"]); if (active <= -1) { active = bookReturnList.Count - 1; } BookReturn bookReturn = bookReturnManager.GetReturns(active); GetData(bookReturn); Session["active"] = active; }
public int Insert(BookReturn bookReturn) { SqlConnection connection = new SqlConnection(connectionString); string query = "INSERT INTO tbl_bookReturn VALUES('" + bookReturn.Date + "','" + bookReturn.DistrictId + "','" + bookReturn.PartyId + "','" + bookReturn.ReturnNo + "','" + bookReturn.ChallanReturn + "','" + bookReturn.Year + "','" + bookReturn.GroupId + "','" + bookReturn.BookId + "','" + bookReturn.Quantity + "','" + bookReturn.ReturnRate + "','" + bookReturn.Total + "','" + bookReturn.TransportBill + "','" + bookReturn.Less + "','" + bookReturn.NetReturn + "')"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); int rowAffected = command.ExecuteNonQuery(); connection.Close(); return(rowAffected); }
protected void searchButton_Click(object sender, EventArgs e) { var r = returnTextBox.Value; BookReturn bookReturn = bookReturnManager.GetSearchInfo(r); if (bookReturn.ReturnNo == null) { message.InnerText = "Invalid Return No!!"; ClearTextBoxes(); } else { GetData(bookReturn); message.InnerText = ""; } }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } BookReturn = await _context.BookReturn .Include(b => b.bookRent).FirstOrDefaultAsync(m => m.Id == id); if (BookReturn == null) { return(NotFound()); } ViewData["BookRentId"] = new SelectList(_context.BookRent, "Id", "Id"); return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } BookReturn = await _context.BookReturn.FindAsync(id); if (BookReturn != null) { _context.BookReturn.Remove(BookReturn); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public BookReturn GetReturns(int i) { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT * FROM tbl_bookReturn ORDER BY id ASC OFFSET " + i + " ROWS FETCH NEXT 1 ROWS ONLY"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); BookReturn bookReturn = new BookReturn(); while (reader.Read()) { GetValueFromDatabase(bookReturn, reader); } reader.Close(); connection.Close(); return(bookReturn); }
public BookReturn GetSearchInfo(string s) { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT * FROM tbl_bookReturn WHERE return_no='" + s + "'"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); BookReturn bookReturn = new BookReturn(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { GetValueFromDatabase(bookReturn, reader); } reader.Close(); connection.Close(); return(bookReturn); }
public BookReturn GetNextReturnNo() { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT TOP 1 * FROM tbl_bookReturn ORDER BY id DESC"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); BookReturn bookReturn = new BookReturn(); while (reader.Read()) { bookReturn.BookReturnId = int.Parse(reader["id"].ToString()); bookReturn.ReturnNo = reader["return_no"].ToString(); } reader.Close(); connection.Close(); return(bookReturn); }
private string LoadNextReturnNo() { BookReturn bookReturn = bookReturnManager.GetNextReturnNo(); string returnNo = bookReturn.ReturnNo; int count; if (returnNo == null) { count = 1; } else { count = (returnNo[3] - '0') * 10 + (returnNo[4] - '0') + 1; } string nextReturnNo = "R-0" + count.ToString("00"); return(nextReturnNo); }
private void GetData(BookReturn bookReturn) { dateTextBox.Value = bookReturn.Date; districtNameDropDownList.Text = bookReturn.DistrictName; partyNameDropDownList.Text = bookReturn.PartyName; returnNoTextBox.Text = bookReturn.ReturnNo; challanReturnDropDownList.Text = bookReturn.ChallanReturn; yearTextBox.Text = bookReturn.Year; groupNameDropDownList.Text = bookReturn.GroupName; bookNameDropDownList.Text = bookReturn.BookId.ToString(); bookRateTextBox.Text = bookReturn.BookRate.ToString(); commissionTextBox.Text = bookReturn.Commission.ToString(); returnRateTextBox.Text = bookReturn.ReturnRate.ToString(); quantityTextBox.Text = bookReturn.Quantity.ToString(); totalTextBox.Text = bookReturn.Total.ToString(); transportBillTextBox.Text = bookReturn.TransportBill.ToString(); lessTextBox.Text = bookReturn.Less.ToString(); netReturnTextBox.Text = bookReturn.NetReturn.ToString(); }
public List <BookReturn> GetAllBookReturnList() { SqlConnection connection = new SqlConnection(connectionString); string query = "SELECT * FROM tbl_bookReturn"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); List <BookReturn> bookReturnList = new List <BookReturn>(); while (reader.Read()) { BookReturn bookReturn = new BookReturn(); GetValueFromDatabase(bookReturn, reader); bookReturnList.Add(bookReturn); } reader.Close(); connection.Close(); return(bookReturnList); }
public async Task AddAsync(BookReturn parameters) { var spParameters = new SqlParameter[1]; spParameters[0] = new SqlParameter() { ParameterName = "BookIssueId", Value = parameters.BookIssueId }; await DbContextManager.StoreProc <StoreProcResult>("[dbo].spReturnBook ", spParameters); try { await DbContextManager.CommitAsync(); } catch (Exception e) { DbContextManager.RollbackTransaction(); } }
public void BookReturn(BookReturn br, OperLog operLog) { using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { string strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString(); DateTime dtSysTime = DateTime.Parse(strSysTime); br.cndReturnDate = dtSysTime; long ibr = EntityMapping.Create(br, trans); operLog.cndOperDate = dtSysTime; operLog.cnvcComments = "回复流水号:" + ibr.ToString(); EntityMapping.Create(operLog, trans); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); throw sex; } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
private void GetValueFromDatabase(BookReturn bookReturn, SqlDataReader reader) { bookReturn.BookReturnId = int.Parse(reader["id"].ToString()); bookReturn.Date = reader["date"].ToString(); bookReturn.DistrictName = reader["district_id"].ToString(); bookReturn.PartyName = reader["party_id"].ToString(); bookReturn.ReturnNo = reader["return_no"].ToString(); bookReturn.ChallanReturn = reader["challan_return"].ToString(); bookReturn.Year = reader["year"].ToString(); bookReturn.GroupName = reader["group_id"].ToString(); bookReturn.BookId = int.Parse(reader["book_id"].ToString()); BookInfo bookInfo = GetBookReturn(bookReturn.BookId); bookReturn.BookRate = bookInfo.BookRate; bookReturn.Commission = bookInfo.BookCommission; bookReturn.Quantity = Convert.ToDouble(reader["quantity"].ToString()); bookReturn.ReturnRate = Convert.ToDouble(reader["return_rate"].ToString()); bookReturn.Total = Convert.ToDouble(reader["total"].ToString()); bookReturn.TransportBill = Convert.ToDouble(reader["transport_bill"].ToString()); bookReturn.Less = Convert.ToDouble(reader["less"].ToString()); bookReturn.NetReturn = Convert.ToDouble(reader["net_return"].ToString()); }
//protected void quantityTextBox_OnTextChanged(object sender, EventArgs e) //{ // double quantity = Convert.ToDouble(quantityTextBox.Text); // double reject = Convert.ToDouble(returnRateTextBox.Text); // double total = quantity*reject; // totalTextBox.Text = total.ToString(); // netReturnTextBox.Text = total.ToString(); // //quantityTextBox.Text = ""; //} //protected void transportBillTextBox_OnTextChanged(object sender, EventArgs e) //{ // double transport = Convert.ToDouble(transportBillTextBox.Text); // double netReturn = Convert.ToDouble(netReturnTextBox.Text); // double totalResult = netReturn + transport; // netReturnTextBox.Text = totalResult.ToString(); // //transportBillTextBox.Text = ""; //} //protected void lessTextBox_OnTextChanged(object sender, EventArgs e) //{ // double less = Convert.ToDouble(lessTextBox.Text); // double netReturn = Convert.ToDouble(netReturnTextBox.Text); // double totalResult = netReturn - less; // netReturnTextBox.Text = totalResult.ToString(); // //lessTextBox.Text = ""; //} protected void saveButton_Click(object sender, EventArgs e) { BookReturn bookReturn = new BookReturn(); bookReturn.Date = dateTextBox.Value; bookReturn.DistrictId = int.Parse(districtNameDropDownList.SelectedValue); bookReturn.PartyId = int.Parse(partyNameDropDownList.SelectedValue); bookReturn.ReturnNo = returnNoTextBox.Text; bookReturn.ChallanReturn = challanReturnDropDownList.SelectedValue; bookReturn.Year = yearTextBox.Text; bookReturn.GroupId = int.Parse(groupNameDropDownList.SelectedValue); bookReturn.BookId = int.Parse(bookNameDropDownList.SelectedValue); string quantity = quantityTextBox.Text; string returnRate = returnRateTextBox.Text; string total = totalTextBox.Text; string transportBill = transportBillTextBox.Text; string less = lessTextBox.Text; string netReturn = netReturnTextBox.Text; if (dateTextBox.Value == "" || returnNoTextBox.Text == "" || yearTextBox.Text == "" || quantityTextBox.Text == "" || returnRateTextBox.Text == "" || transportBillTextBox.Text == "" || lessTextBox.Text == "" || netReturnTextBox.Text == "") { messageLabel.InnerText = "All Fields are Required!!"; } else { bookReturn.Quantity = Convert.ToDouble(quantity); bookReturn.ReturnRate = Convert.ToDouble(returnRate); bookReturn.Total = Convert.ToDouble(total); bookReturn.TransportBill = Convert.ToDouble(transportBill); bookReturn.Less = Convert.ToDouble(less); bookReturn.NetReturn = Convert.ToDouble(netReturn); messageLabel.InnerText = bookReturnManager.Save(bookReturn); } ClearTextBoxes(); }
private void btnreturn_Click(object sender, EventArgs e) { BookReturn returnedbook = new BookReturn(); Books newstock2 = new Books(); int bookid = Convert.ToInt32(databook.SelectedRows[0].Cells[0].Value); int stdid = Convert.ToInt32(datastudent.SelectedRows[0].Cells[0].Value); returnedbook.BookID = bookid; returnedbook.StudentID = stdid; returnedbook.ReturnDate = DateTime.Today; service.BooksReturnService.insert(returnedbook); int id = Convert.ToInt32(databook.SelectedRows[0].Cells[0].Value); newstock2 = db.Books.Find(id); newstock2.BookName = databook.SelectedRows[0].Cells[1].Value.ToString(); newstock2.Author = databook.SelectedRows[0].Cells[2].Value.ToString(); newstock2.GenresID = Convert.ToInt32(databook.SelectedRows[0].Cells[3].Value); newstock2.Available = true; db.SaveChanges(); MessageBox.Show("Book Return is Recorded"); datastudent.DataSource = service.StudentService.GetAll(); databook.DataSource = service.BooksService.GetByCondition(x => x.Available == false); }
public HashSet <string> DeleteValidation(BookReturn parameters) { return(ValidationMessages); }
public Task DeleteAsync(BookReturn parameters) { throw new NotImplementedException(); }
protected void btnBook_Click(object sender, System.EventArgs e) { try { OperLog operLog = new OperLog(); operLog.cnvcOperID = oper.strLoginID; operLog.cnvcDeptID = oper.strDeptID; Book book = new Book(); book.cmvcPublishID = oper.strLoginID; book.cnvcPublishName = oper.strOperName; book.cnvcCheckDept = this.ddlCheckDept.SelectedItem.Text; if (this.txtSerialNo.Text != "") { book.cnnSerialNo = Convert.ToInt32(this.txtSerialNo.Text); } if (this.txtBook.Text.Trim().Length == 0) { throw new Exception("请输入留言"); } Business.BookFacade bf = new BookFacade(); switch (this.txtFlag.Text) { case "ADD": operLog.cnvcOperType = "添加留言"; book.cnvcBook = this.txtBook.Text; book.cnvcState = "0"; bf.AddBook(book, operLog); this.Popup("添加留言成功"); break; case "MODIFY": operLog.cnvcOperType = "修改留言"; book.cnvcBook = this.txtBook.Text; book.cnvcCheckDept = this.ddlCheckDept.SelectedItem.Text; bf.UpdateBook(book, operLog); this.Popup("修改留言成功"); break; case "CANCELCHECK": operLog.cnvcOperType = "取消确认留言"; book.cnvcCheckID = oper.strLoginID; book.cnvcCheckName = oper.strOperName; book.cnvcState = "0"; bf.CheckBook(book, operLog); this.Popup("取消确认留言成功"); break; case "CHECK": operLog.cnvcOperType = "确认留言"; book.cnvcCheckID = oper.strLoginID; book.cnvcCheckName = oper.strOperName; book.cnvcState = "1"; bf.CheckBook(book, operLog); this.Popup("确认留言成功"); break; case "RETURN": operLog.cnvcOperType = "回复留言"; Entity.BookReturn br = new BookReturn(); br.cnnBookID = Convert.ToInt32(txtSerialNo.Text); br.cnvcReturn = txtBook.Text; br.cnvcReturnID = oper.strLoginID; br.cnvcReturnName = oper.strOperName; bf.BookReturn(br, operLog); BindReturn(txtSerialNo.Text); this.Popup("回复成功"); break; } this.btnBook.Enabled = true; btnReset_Click(null, null); this.btnQuery1_Click(null, null); this.btnQuery2_Click(null, null); } catch (Exception ex) { this.Popup(ex.Message); } }
public int InsertBookReturn(BookReturn bookReturn) { this._bookReturnRepository.Insert(bookReturn); return(bookReturn.Id); }