private void CustomizedListItem_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (DetailsCommand != null && DetailsCommand.CanExecute(DetailsCommandParameter))
     {
         DetailsCommand.Execute(DetailsCommandParameter);
     }
 }
Ejemplo n.º 2
0
 public WeatherVM()
 {
     Forecasts       = new ObservableCollection <DailyForecast>();
     Cities          = new ObservableCollection <City>();
     SelectedCity    = new City();
     MRefreshCommand = new RefreshCommand(this);
     MDetailsCommand = new DetailsCommand(this);
 }
        public DetailsCommand GetOne(int Id)
        {
            DetailsCommand dc  = new DetailsCommand();
            Command        cmd = _commandRepo.GetOne(Id).CommandDTOToCommanDAO();

            dc.DateOfCommand = cmd.DateOfCommand;
            dc.Address       = _addressRepo.GetAddressByClientAddress(cmd.IdAddress).AddressDTOToAddressDAO();
            dc.Address.City  = _cityRepo.GetOne(dc.Address.City.Id).CityDTOToCityDAO();
            dc.Client        = _clientRepo.GetOne(cmd.IdClient).ClientDTOToClientDAO();
            dc.Commandwine   = _commandRepo.GetAllCommandWineByCommandId(Id).Select(x => x.CommandWineDAOToCommandWineDTO()).ToList();
            foreach (CommandWine cw in dc.Commandwine)
            {
                cw.wineName  = _wineRepo.GetOne(cw.IdWine).WineName;
                cw.winePrice = _wineRepo.GetWinePrice(cw.IdWine).FirstOrDefault().PriceWine;
            }
            return(dc);
        }
Ejemplo n.º 4
0
        private static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Not enough arguments !");
                return;
            }

            Config.Model = args[0].ToLower().UppercaseFirst();
            var command = "";

            if (args.Length > 1)
            {
                command = args[1].ToLower();
            }

            if (args.Length > 2)
            {
                Config.Area = args[2].ToLower().UppercaseFirst();
            }

            Config.ModelsPath     = Environment.CurrentDirectory + "\\";
            Config.ViewModelsPath = new System.IO.DirectoryInfo(Config.ModelsPath).Parent.FullName + "\\ViewModels\\";
            Config.RepositoryPath = new System.IO.DirectoryInfo(Config.ModelsPath).Parent.Parent.FullName + "\\Repository\\";
            Config.ServicePath    = new System.IO.DirectoryInfo(Config.ModelsPath).Parent.Parent.FullName + "\\Service\\";

            if (string.IsNullOrEmpty(Config.Area))
            {
                Config.ControllerPath = new System.IO.DirectoryInfo(Config.ModelsPath).Parent.Parent.Parent.FullName + "\\Portal.Web\\Controllers\\";
                Config.ViewsPath      = new System.IO.DirectoryInfo(Config.ModelsPath).Parent.Parent.Parent.FullName + "\\Portal.Web\\Views\\" + Config.Model + "\\";
            }
            else
            {
                Config.ControllerPath = new System.IO.DirectoryInfo(Config.ModelsPath).Parent.Parent.Parent.FullName + "\\Portal.Web\\Areas\\" + Config.Area + "\\Controllers\\";
                Config.ViewsPath      = new System.IO.DirectoryInfo(Config.ModelsPath).Parent.Parent.Parent.FullName + "\\Portal.Web\\Areas\\" + Config.Area + "\\Views\\" + Config.Model + "\\";
            }

            var viewsDir = new System.IO.DirectoryInfo(Config.ViewsPath);

            if (!viewsDir.Exists)
            {
                viewsDir.Create();
            }

            Config.PropertyNames        = ClassHelper.GetPropertyNames(Config.ModelsPath + Config.Model + ".cs");
            Config.PropertyTypes        = ClassHelper.GetPropertyTypes(Config.ModelsPath + Config.Model + ".cs");
            Config.PropertyDeclarations = ClassHelper.GetPropertyDeclarations(Config.ModelsPath + Config.Model + ".cs");

            switch (command)
            {
            case "sr":
            case "service":
                var iserviceCommand = new IServiceCommand();
                var serviceCommand  = new ServiceCommand();
                iserviceCommand.Execute();
                serviceCommand.Execute();
                break;

            case "rp":
            case "repository":
                var irepositoryCommand = new IRepositoryCommand();
                var repositoryCommand  = new RepositoryCommand();
                irepositoryCommand.Execute();
                repositoryCommand.Execute();
                break;

            case "vm":
            case "viewmodel":
                var viewModelCommand = new ViewModelCommand();
                viewModelCommand.Execute();
                break;

            case "ad":
            case "addmodel":
                var addModel = new AddModelCommand();
                addModel.Execute();
                break;

            case "vi":
            case "views":
                var indexCommand   = new IndexCommand();
                var createCommand  = new CreateCommand();
                var editCommand    = new EditCommand();
                var deleteCommand  = new DeleteCommand();
                var detailsCommand = new DetailsCommand();

                indexCommand.Execute();
                createCommand.Execute();
                editCommand.Execute();
                deleteCommand.Execute();
                detailsCommand.Execute();

                break;

            case "cr":
            case "controller":
                var controllerCommand = new ControllerCommand();
                controllerCommand.Execute();
                break;

            case "go":
            default:
                var goCommand = new GoCommand();
                goCommand.Execute();


                break;
            }
        }