public int SaveOrder(Order order) { var parameters = new DynamicParameters(); parameters.Add("@Number", order.Number, DbType.String); parameters.Add("@CreateDate", order.CreateDate, DbType.DateTime); parameters.Add("@SenderName", order.SenderName, DbType.String); parameters.Add("@SenderInn", order.SenderInn, DbType.String); parameters.Add("@SenderKpp", order.SenderKpp, DbType.String); parameters.Add("@ReceiverName", order.ReceiverName, DbType.String); parameters.Add("@ReceivertInn", order.ReceivertInn, DbType.String); parameters.Add("@ReceiverKpp", order.ReceiverKpp, DbType.String); using (var conn = Connection) { conn.Open(); return conn.Query<int>("dbo.SaveOrder", parameters, commandType: CommandType.StoredProcedure).FirstOrDefault(); } }
public int SaveOrder(Order order) { return _orderRepository.SaveOrder(order); }
public void UseOrderWithID(int id) { _order = _model.GetByID(id); _client = _order.Client; _orderNumber = _order.OrderNumber; _status = _order.Status; _date = _order.Date; _comments = new BindingList<Comment>(_order.Comments.ToList()); _orderItems = new BindingList<OrderItem>(_order.OrderItems); _state = _order.IsActive; _id = id; _totalPrice = _order.Sum; }
public void Save() { if (_order.Id != 0) { _order.Comments = _comments; _order.Client = _client; _order.Date = _date; _order.OrderItems = _orderItems.ToList(); _order.IsActive = _state; _order.Id = _id; _order.Status = _status; _order.OrderNumber = _orderNumber; _model.Save(_order); } else { var newOrderToSave = new Order(_comments, new List<OrderItem>(_orderItems)) { Client = _client, Date = _date, IsActive = _state, Id = _id, Status = _status, OrderNumber = _orderNumber }; _model.Create(newOrderToSave); _id = newOrderToSave.Id; _order = newOrderToSave; } }
public void New() { _order = new Order(Domain.Entities.Comments.Comments.Init(Program.AuthUser, "Order"), new List<OrderItem>()); _client = new Client() { ClientLocation = new Location(), Person = new Domain.Entities.Person() }; _orderNumber = string.Empty; _status = Status.Opened; _date = DateTime.Now; _state = true; _orderItems = new BindingList<OrderItem>(); _comments = new BindingList<Comment>(); _id = 0; NotifyPropertyChanged(); }
public void Save(Order currentOrder) { OrderRepository.Update(currentOrder); }
public void Create(Order currentOrder) { OrderRepository.Create(currentOrder); }