Skip to content
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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Added commands for order #25

wants to merge 20 commits into from

Conversation

Breslavchik
Copy link
Collaborator

No description provided.

@Breslavchik Breslavchik requested a review from Negodyaj January 10, 2022 14:50

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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;
Copy link
Collaborator

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();
?

Copy link
Collaborator

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
Copy link
Collaborator

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);
}
Copy link
Collaborator

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)
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (_clientService.GetAllClients().Success)

@Breslavchik Breslavchik requested a review from Negodyaj January 10, 2022 22:28
@Breslavchik Breslavchik requested review from Svyatopes and Negodyaj and removed request for Negodyaj and Svyatopes January 11, 2022 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants