private void btnAllDetails_ItemClick(object sender, ItemClickEventArgs e) { if (!isNew) { stockDetailsBindingSource.DataSource = _stockDetails.Find(dt => dt.StockRecievedID == stockId).ToList(); } }
public ActionResult InsertOrUpdate(Course course) { var aResult = new ActionResult(); try { if (course.CourseID <= 0) { if (_repository.Find(e => e.Name.ToLower() == course.Name.ToLower()).Count() > 0) { aResult.Exceptions.Add(new Exception(String.Format("Category {0} had been exited!", course.Name))); } else if (_repository.Add(course) <= 0) { aResult.Exceptions.Add(new Exception("Inserted process had been failed!")); } } else { if (!_repository.Update(course)) { aResult.Exceptions.Add(new Exception("Updated process had been failed!")); } } } catch (Exception ex) { aResult.Exceptions.Add(ex); } return(aResult); }
/// <summary> /// Deletes the product. /// </summary> /// <param name="productId">The product identifier.</param> public void DeleteProduct(int productId) { if (productId < 0) { throw new ArgumentOutOfRangeException(nameof(productId)); } var source = _productRepo.Find(productId); this._productRepo.Delete(source); }
/// <summary> /// Gets the order. /// </summary> /// <param name="orderId">The order identifier.</param> /// <returns>OrderDto.</returns> /// <exception cref="System.ArgumentOutOfRangeException">orderId</exception> public OrderDto GetOrder(int orderId) { if (orderId < 0) { throw new ArgumentOutOfRangeException(nameof(orderId)); } var source = _orderRepo.Find(orderId); var dto = Mapper.Map <Orders, OrderDto>(source); return(dto); }
private void edbFindAdminUse_EditValueChanged(object sender, EventArgs e) { string temp = ((string)edbFindAdminUse.EditValue).ToLower(); if (String.IsNullOrEmpty(temp)) { btnAll.PerformClick(); } else { stockReceivedsBindingSource.DataSource = _stockRepository.Find(st => st.AdminID.ToLower().Contains(temp)); } }
public ValidationResult Validate(Member obj) { var vResult = new ValidationResult(); if (string.IsNullOrEmpty(obj.Name) || string.IsNullOrEmpty(obj.Name.Trim())) { vResult.Messages.Add("Member's name does not accept null or empty!"); } if (_repository.Find(e => e.Name.ToLower() == obj.Name.ToLower()).Count() > 0) { vResult.Messages.Add("Member's name had have been exited!"); } //Check email's type; string email = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; if (!StringExtension.Test(obj.Email, email)) { vResult.Messages.Add("Member's email had not have been corrected!"); } if (string.IsNullOrEmpty(obj.Email) || string.IsNullOrEmpty(obj.Email.Trim())) { vResult.Messages.Add("Member's email does not accept null or empty!"); } if (_repository.Find(e => e.Email.ToLower() == obj.Email.ToLower()).Count() > 0) { vResult.Messages.Add("Member's email had have been exited!"); } if (string.IsNullOrEmpty(obj.Password) || string.IsNullOrEmpty(obj.Password.Trim())) { vResult.Messages.Add("Member's passwords does not accept null or empty!"); } if (obj.Password.Length <= 6) { vResult.Messages.Add("Member's password must more than 6 character!"); } if (obj.IsActive == null) { vResult.Messages.Add("Member's IsActive does not accept null!"); } return(vResult); }
private void btnDetailsAll_ItemClick(object sender, ItemClickEventArgs e) { if (!isNew) { current = layoutViewBills.GetRow(layoutViewBills.FocusedRowHandle) as Bill; } var li = _repBillDetails.Find(dt => dt.BillID == current.ID).ToList(); li.ForEach(i => { i.BillInfo = current; i.OrderInfo = _repOrders.Find(or => or.ID == i.OrderID).First(); i.OrderInfo.CustomerInfo = _repMembers.Find(cus => cus.UseName == i.OrderInfo.CusID).First(); }); bindingSource.DataSource = li; }
private void edtCusUse_EditValueChanged(object sender, EventArgs e) { var li = _repBills.Find(b => b.CusID.ToLower().Contains(edtCusUse.EditValue.ToString().ToLower())).ToList(); li.ForEach(i => { i.CusInfo = _repMembers.Find(m => m.UseName == i.CusID).First(); i.CusName = i.CusInfo.FullName; }); li.ForEach(i => { i.SelerInfo = _repMembers.Find(m => m.UseName == i.SelID).First(); i.SalerName = i.SelerInfo.FullName; }); bindingSource.DataSource = li; }
private void bedId_EditValueChanged(object sender, EventArgs e) { if (bedId.EditValue.ToString().Equals(string.Empty)) { btnRefreshPro.PerformClick(); return; } try { int id = int.Parse(bedId.EditValue.ToString()); gridProducts.DataSource = _repProducts.Find(p => p.ID == id).ToList(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void WageListForm_Load(object sender, EventArgs e) { _repMember = new MemberRepository(); repEmployees.DataSource = _repMember.Find(em => em.CategoryInfo.Location == "Admin" || em.CategoryInfo.Location == "Saler"); _repCoefficient = new GeneralRepository <WageCoefficient>(); repCoefficient.DataSource = _repCoefficient.Find(w => w.Deleted == false).ToList(); _repository = new GeneralRepository <Wage>(); _manager = new WageMagager(_repository); btnRefresh_Click(null, null); }
private void gridView_ValidateRow(object sender, ValidateRowEventArgs e) { ColumnView view = sender as ColumnView; GridColumn col = view.Columns["Name"]; bool save = true; string temp = (string)view.GetRowCellValue(e.RowHandle, col); if (temp == null || String.IsNullOrEmpty(temp.Trim())) { e.Valid = false; view.SetColumnError(col, "Product's name is not accepted null or empty!"); save = false; } if (newRow && temp != null && _repository.Find(p => p.Name.ToLower() == temp.ToLower()).ToList().Count > 1) { e.Valid = false; view.SetColumnError(col, "Product's name is exited!"); save = false; } col = view.Columns["Quantity"]; int quantity = (int)view.GetRowCellValue(e.RowHandle, col); if (quantity == null || quantity < 0) { e.Valid = false; view.SetColumnError(col, "Product's quantiry is not accepted less than zezo!"); save = false; } col = view.Columns["Type"]; bool type = (bool)view.GetRowCellValue(e.RowHandle, col); if (type == null) { e.Valid = false; view.SetColumnError(col, "Product's type is not accepted null!"); save = false; } col = view.Columns["Price"]; decimal price = (decimal)view.GetRowCellValue(e.RowHandle, col); if (price == null || price < 0) { e.Valid = false; view.SetColumnError(col, "Product's price is not accepted less than zezo!"); save = false; } btnSave.Enabled = save; }
private void BillListForm_Load(object sender, EventArgs e) { _repBills = new GeneralRepository <Bill>(); _repBillDetails = new GeneralRepository <BillDetail>(); _repMembers = new MemberRepository(); _repOrders = new GeneralRepository <Order>(); _repOrderDetails = new GeneralRepository <OrderDetail>(); _repProducts = new GeneralRepository <Product>(); bills = new List <Bill>(); repOrders.DataSource = _repOrders.Find(or => or.Deleted == false).ToList(); btnAll.PerformClick(); repCustomers.DataSource = _repMembers.GetAll().ToList(); }
private void btnRefresh_Click(object sender, EventArgs e) { var li = _repository.GetAll().ToList(); li.ForEach(i => { i.WageCoefficientInfo = _repCoefficient.Find(c => c.ID == i.CoefficientsID).FirstOrDefault(); i.Point = i.WageCoefficientInfo.Point; }); li.ForEach(i => { i.AdminInfo = _repMember.Find(m => m.UseName == i.AdminID).FirstOrDefault(); }); li.ForEach(i => { i.EmployeeInfo = _repMember.Find(m => m.UseName == i.EmployeeID).FirstOrDefault(); }); wagesBindingSource.DataSource = li; }
public ActionResultAsList <Class> Find(Expression <Func <Class, bool> > predicate) { var aResult = new ActionResultAsList <Class>(); try { aResult.Result = _repository.Find(predicate).ToList(); if (aResult.Result.Count == 0) { aResult.Exceptions.Add(new Exception("Searching had have been ending and not found!")); } } catch (Exception ex) { aResult.Exceptions.Add(ex); } return(aResult); }
public ActionResultAsList <Wage> Find(Expression <Func <Wage, bool> > predicate) { var aResult = new ActionResultAsList <Wage>(); try { aResult.Result = _repository.Find(predicate).ToList(); if (aResult.Result.Count == 0) { aResult.Exceptions.Add(new Exception("Not found!")); } } catch (Exception ex) { aResult.Exceptions.Add(ex); } return(aResult); }
private void btnPrinter_ItemClick(object sender, ItemClickEventArgs e) { var bill = layoutViewBills.GetRow(layoutViewBills.FocusedRowHandle) as Bill; if (bill.CusInfo == null) { bill.CusInfo = _repMembers.GetByUseName(bill.CusID); } if (bill.SelerInfo == null) { bill.SelerInfo = _repMembers.GetByUseName(bill.SelID); } var listDetails = _repBillDetails.Find(dt => dt.BillID == bill.ID).ToList(); var listOrders = new List <Order>(); listDetails.ForEach(i => { var temp = _repOrders.GetById(i.OrderID); temp.CustomerInfo = _repMembers.GetByUseName(temp.CusID); listOrders.Add(temp); }); listOrders.ForEach(i => { i.CustomerInfo = _repMembers.GetByUseName(i.CusID); i.DetailsInfo = _repOrderDetails.Find(dt => dt.OrderID == i.ID).ToList(); i.DetailsInfo.ForEach(j => { j.ProductInfo = _repProducts.GetById(j.ProID); }); }); var printer = new XtraReportBill(bill, listOrders); printer.ShowPreview(); }
private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { ColumnView view = sender as ColumnView; GridColumn col = view.Columns["Point"]; float temp = (float)view.GetRowCellValue(e.RowHandle, col); if (temp == null || temp > 4f || temp < 0.5f) { e.Valid = false; view.SetColumnError(col, "The point is not to accepte null and it's less than 4.0 and more than 0.5!"); saveToolStripMenuItem.Enabled = false; } else if (_repository.Find(w => w.Point == temp && w.AdminID == currMember.UseName).ToList().Count > 0) { e.Valid = false; view.SetColumnError(col, "This point is exited!"); saveToolStripMenuItem.Enabled = false; } else { saveToolStripMenuItem.Enabled = true; } }