-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added commands for order #25
base: master
Are you sure you want to change the base?
Conversation
|
||
namespace Alligator.DataLayer.Repositories | ||
{ | ||
public abstract class BaseRepository | ||
{ | ||
private const string _connection = "Data Source=80.78.240.16;Database=AggregatorAlligator;User Id=student;Password=qwe!23;"; | ||
|
||
protected static SqlConnection ProvideConnection() => new SqlConnection(_connection); | ||
public static SqlConnection ProvideConnection() => new SqlConnection(_connection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
поменяй обратно на протектед
@@ -8,7 +8,7 @@ public interface IOrderRepository | |||
{ | |||
int AddOrder(DateTime date, int clientId, string address); | |||
void DeleteOrder(int id); | |||
void EditOrder(DateTime date, int id, string address); | |||
void EditOrder(DateTime date, int orderId, int clientId, string address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а объект ордера передать не судьба?)
return; | ||
List<OrderDetailModel> orderDetails = new List<OrderDetailModel>(); | ||
|
||
_viewModel.NewOrder.OrderDetails = orderDetails; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а нельзя было написать _viewModel.NewOrder.OrderDetails =new List();
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в одну строчку, в общем)
MessageBox.Show("Ошибка при добавлении заказа в базу данных", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); | ||
return; | ||
} | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else можно просто убрать и писать код дальше без такого шикарного отступа
foreach (var orderDetail in _viewModel.NewOrderDetails) | ||
{ | ||
_orderDetailService.AddOrderDetailModel(orderDetail.Amount, orderId, orderDetail.Product.Id); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вот эти два форыча нужно перекинуть в метод сервиса
@@ -25,9 +26,15 @@ public override void Execute(object parameter) | |||
{ | |||
|
|||
_viewModel.AllOrders.Clear(); | |||
foreach (var order in _orderService.GetOrders()) | |||
if (_orderService.GetOrders().Success is true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
то же самое, что и if (_orderService.GetOrders().Success)
_viewModel.ChangedDate = _viewModel.SelectedOrder.Date; | ||
_viewModel.ChangedAddressText = _viewModel.SelectedOrder.Address; | ||
_viewModel.Clients.Clear(); | ||
if (_clientService.GetAllClients().Success is true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (_clientService.GetAllClients().Success)
No description provided.