private void Button_Click(object sender, RoutedEventArgs e) { int userId = ResourcesHelper.CurrentUser.UserId; DateTime startDateTime = DateTime.Now.Date; DateTime endDateTime = DateTime.Now.Date.AddDays(1); int maxTodayId = _saleOrderRepository.Query() .Count(x => x.DateOriginated >= startDateTime && x.DateOriginated < endDateTime) + 1; string saleOrderNo = string.Format("{0}{1}{2}", DateTime.Now.ToString("yyyyMMddHH"), userId, maxTodayId.ToString().PadLeft(4, '0')); var saleOrderForm = new SaleOrderForm(this, new DataModel.Model.SaleOrder { DateOriginated = DateTime.Now, SaleOrderNo = saleOrderNo, OriginUserId = userId }); saleOrderForm.ShowDialog(); }
public BalanceFrom(SaleOrderForm saleOrderFormWindow, IUnitOfWork unitOfWork, DataModel.Model.SaleOrder saleOrder) { InitializeComponent(); _unitOfWork = unitOfWork; _saleOrderRepository = _unitOfWork.GetRepository <SaleOrderRepository>(); _soProduceRepository = _unitOfWork.GetRepository <SOProduceRepository>(); _produceRepository = _unitOfWork.GetRepository <ProduceRepository>(); _userRepository = _unitOfWork.GetRepository <UserRepository>(); _saleOrderFormWindow = saleOrderFormWindow; _saleOrder = saleOrder; _balanceDomainModel = new BalanceDomainModel { TotalPrice = saleOrder.TotalCost ?? 0, DiscountPrice = 0.0f, CashTotal = _user.CashTotal, }; DataContext = new { BalanceDomainModel = _balanceDomainModel, ResourcesHelper.CurrentUserRolePermission, }; RadBanlanceModeCard.Click += (s, e) => { TabItemCard.IsSelected = true; }; RadBanlanceModeCash.Click += (s, e) => { TabItemCash.IsSelected = true; }; }
private void ButEditSaleOrder_Click(object sender, RoutedEventArgs e) { var saleOrderForm = new SaleOrderForm(this, (DataModel.Model.SaleOrder)GridSaleOrders.SelectedItem); saleOrderForm.ShowDialog(); }