private void BtnRegisterReturn_Click(object sender, EventArgs e) { try { if (borrBO != null) { brBO = new BorrowReturn(); brBLL = new BorrowReturnBLL(); bill = new Bill(); billBLL = new BillBLL(); brBO.BorrowId = borrBO.BorrowId; brBO.ReturnDate = DateTime.Now; brBO.Comment = "ska tash"; brBO.InsBy = FormLoggedUser.Id; if (PayBill) { bill.BillingDate = DateTime.Now; bill.BillTypeId = 2; bill.MaterialId = borrBO.materialId; bill.SubscriberId = borrBO.SubscriberId; bill.Price = delayfee; bill.InsBy = FormLoggedUser.Id; brBO.BillId = billBLL.Add(bill); if (brBO.BillId < 1) { throw new Exception(); } } brBLL.Add(brBO); } else { MessageBox.Show("Material wasn't provided"); } } catch (Exception ex) { MessageBox.Show("Material is not returned, contact your administrator"); } }
static void Main(string[] args) { //SubscriberBLL sb = new SubscriberBLL(); // sb.GetExpiredSubscribersEmail(); //EmailService em = new EmailService(); //em.SendMails("*****@*****.**", "send from c# Endrit Tmava", "Funksionoi dergimi i email nga Library Management"); //em.SendMails("*****@*****.**", "send from c# Endrit Tmava", "Funksionoi dergimi i email nga Library Management"); // RoleBLL rolebll; // List<Role> role; // rolebll = new RoleBLL(); // role = rolebll.GetAllRoles(); // //comboRoleCreate.DataSource = role; // string errors = ""; // User usr = new User(); // usr.Name = "a"; // usr.LastName = "a"; // usr.Email = "a"; // usr.Username = "******"; // usr.InsBy = FormLoggedUser.Id; // usr.Password = "******"; // //usr._role = getRole(); // //usr.RoleID = usr._role.UserRoleId; // UsersValidation usrval = new UsersValidation(); // usrval.validateCreateUser(); // ValidationResult vres = usrval.Validate(usr); // if (vres.IsValid == false) // { // foreach (ValidationFailure item in vres.Errors) // { // errors += $" {item.ErrorMessage} \n \n"; // } // MessageBox.Show(errors,"ERROR WARNING",MessageBoxButtons.OK,MessageBoxIcon.Warning); // } //} //public Role getRole() //{ // return comboRoleCreate.SelectedItem as Role; //}\ //Material mat = new Material(); //MaterialBLL mbll = new MaterialBLL(); //mat.MaterialId = 1020; //mat.Title = "tryagain"; //mat._Genre.GenreId = 1; //mat._PublishHouse._PublishHouse = "Shpijajem"; //mat.PublishPlace = "FFK"; //mat._MaterialType.MaterialTypeId = 1; //mat.AvailableCoppies = 4; //mat.Quantity = 4; //mat._Language.LanguageId = 1; //mat.LanguageId = 1; //mat.UpdBy = 80; //mat._Author.AuthorName = "Endrittmavahe"; //Console.WriteLine(mbll.Update(mat).ToString()); BorrowBLL borrow = new BorrowBLL(); BorrowReturn br = new BorrowReturn(); br.BorrowReturnId = 3; br.BorrowId = 2; br.ReturnDate = DateTime.Now; br.Comment = "asdenaaa"; br.UpdBy = 80; BorrowReturnBLL brb = new BorrowReturnBLL(); brb.Update(br); //foreach (var item in borrow.GetAll()) //{ // Console.WriteLine($"{item.SubscriberId}, {item.materialId}, {item.DeadLine}"); //} }