public async static void MakeModalDocument(GenericViewModel _itemViewModel, string AssemblyName, string ViewName)
        {
            ChildWindow w = new ChildWindow();

            w.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));

            w.ShowTitleBar    = true;
            w.ShowCloseButton = true;
            UserControl control = GetView(AssemblyName, ViewName);

            control.Margin = new Thickness(2.0);

            control.DataContext = _itemViewModel;
            w.Content           = control;
            ActiveWindow        = w;

            //w.Closing += w_Closing;
            //w.WindowStyle = WindowStyle.ToolWindow;

            //w.ShowInTaskbar = false;


            //w.Height = control.Height + 40;
            //w.Width = control.Width + 20;
            //ActiveWindow = w;
            await MainWindow.ShowChildWindowAsync(w);

            //ActiveWindow.Closing -= w_Closing;
        }
        public async static void MakeModalDocument(GenericViewModel _itemViewModel)
        {
            ChildWindow w = new ChildWindow();

            w.OverlayBrush     = null;
            w.CloseByEscape    = true;
            w.Background       = new SolidColorBrush(Color.FromRgb(255, 255, 255));
            w.EnableDropShadow = true;
            w.OverlayBrush     = new SolidColorBrush(Colors.Gray)
            {
                Opacity = 0.5
            };
            w.AllowMove       = true;
            w.ShowTitleBar    = true;
            w.ShowCloseButton = true;
            UserControl control = GetViewVMB(_itemViewModel);

            control.Margin = new Thickness(2.0);

            control.DataContext = _itemViewModel;

            w.Content    = control;
            ActiveWindow = w;
            MainWindow.ShowDialogsOverTitleBar = true;
            _itemViewModel.ViewModelClosing   += _itemViewModel_ViewModelClosing;
            await MainWindow.ShowChildWindowAsync(w, ChildWindowManager.OverlayFillBehavior.FullWindow);
        }
        public GenericViewModel GetDistrictBlockVilage(int id, char type)
        {
            DataSet          districtBlockVilage = _Apdal.GetDistrictBlockVilage(id, type);
            GenericViewModel model = new GenericViewModel();

            if ((districtBlockVilage != null))
            {
                if (districtBlockVilage.Tables[0].Rows.Count <= 0)
                {
                    return(model);
                }
                List <GenericModel> list = new List <GenericModel>();
                for (int i = 0; i < districtBlockVilage.Tables[0].Rows.Count; i++)
                {
                    GenericModel item = new GenericModel
                    {
                        Id   = Convert.ToInt32(districtBlockVilage.Tables[0].Rows[i]["Id"].ToString()),
                        Name = districtBlockVilage.Tables[0].Rows[i]["Name"].ToString()
                    };
                    list.Add(item);
                }
                model.List = list;
            }
            return(model);
        }
Exemple #4
0
        /// <summary>
        /// Constructor called with a view model
        /// This is the primary way to open the page
        /// The viewModel is the data that should be displayed
        /// </summary>
        public BandMemberPage(GenericViewModel <CharacterModel> data)
        {
            InitializeComponent();
            Title = "Band Member";

            BindingContext = this.ViewModel = data;
        }
Exemple #5
0
        /// <summary>
        /// Base constructor for Char Update Page
        /// </summary>
        public CharacterUpdatePage(GenericViewModel <BaseCharacter> data)
        {
            InitializeComponent();

            BindingContext = this.ViewModel = data;
            CharacterTypePicker.SelectedItem = data.Data.Attribute.ToString();
        }
Exemple #6
0
        public void CreateOrganization_Action_Fails()
        {
            // Arrange
            var organizationDto = TestHelper.OrganizationDto();

            GenericServiceResponse <bool> fakeResponse = null;

            mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable();
            mockClientServicesProvider.Setup(x => x.OrganizationService.CreateOrganization(organizationDto)).Returns(fakeResponse).Verifiable();

            var viewModel = new GenericViewModel();

            var action = new CreateOrganization <GenericViewModel>(mockClientServicesProvider.Object)
            {
                OnComplete = model => viewModel = model
            };

            // Act
            var result = action.Invoke(organizationDto);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(GenericViewModel));
            Assert.IsNotNull(result.Notifications);
            Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection));
            Assert.IsTrue(result.Notifications.Count() == 1);
            Assert.IsTrue(result.HasErrors);
            Assert.IsNotNull(result.Success);
            Assert.IsInstanceOfType(result.Success, typeof(bool));
            Assert.IsFalse(result.Success);
        }
 public EventsController()
 {
     oGenericViewModel = new GenericViewModel();
     oMoviesModelClass = new MoviesModelClass();
     oFilmHouseModel   = new FilmHouseModel();
     oEventClassModel  = new EventClassModel();
 }
Exemple #8
0
        public void DeletePhoneNumber_Action_Success()
        {
            // Arrange
            var phoneNumberDto = TestHelper.PhoneNumberDto();

            var fakeResponse = new GenericServiceResponse <bool>
            {
                Result = true
            };

            mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable();
            mockClientServicesProvider.Setup(x => x.PhoneNumberService.DeletePhoneNumber(phoneNumberDto)).Returns(fakeResponse).Verifiable();

            var viewModel = new GenericViewModel();

            var action = new DeletePhoneNumber <GenericViewModel>(mockClientServicesProvider.Object)
            {
                OnComplete = model => viewModel = model
            };

            // Act
            var result = action.Invoke(phoneNumberDto);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(GenericViewModel));
            Assert.IsNotNull(result.Notifications);
            Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection));
            Assert.IsTrue(result.Notifications.Count() == 0);
            Assert.IsFalse(result.HasErrors);
            Assert.IsNotNull(result.Success);
            Assert.IsInstanceOfType(result.Success, typeof(bool));
            Assert.IsTrue(result.Success);
        }
Exemple #9
0
        public void DeleteUserById_Action_Fails()
        {
            // Arrange
            GenericServiceResponse <bool> fakeResponse = null;

            mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable();
            mockClientServicesProvider.Setup(x => x.UserService.DeleteUser(It.IsAny <int>())).Returns(fakeResponse).Verifiable();

            var viewModel = new GenericViewModel();

            var action = new DeleteUserById <GenericViewModel>(mockClientServicesProvider.Object)
            {
                OnComplete = model => viewModel = model
            };

            // Act
            var result = action.Invoke(1);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(GenericViewModel));
            Assert.IsNotNull(result.Notifications);
            Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection));
            Assert.IsTrue(result.Notifications.Count() == 1);
            Assert.IsTrue(result.HasErrors);
            Assert.IsNotNull(result.Success);
            Assert.IsInstanceOfType(result.Success, typeof(bool));
            Assert.IsFalse(result.Success);
        }
        /// <summary>
        /// Constructor for MonsterReadPage
        ///
        /// The ViewModel is the data that should be displayed
        /// </summary>
        /// <param name="data"></param>
        public MonsterReadPage(GenericViewModel <MonsterModel> data)
        {
            InitializeComponent();

            BindingContext       = this.ViewModel = data;
            this.ViewModel.Title = "Read";
        }
        /// <summary>
        /// Constructor that takes an existing data item
        /// </summary>
        public CharacterUpdatePage(GenericViewModel <CharacterModel> data)
        {
            InitializeComponent();


            BindingContext = this.ViewModel = data;

            this.ViewModel.Title = "Update " + data.Title;

            OriginalImageURi = data.Data.ImageURI;

            ImagePic.SelectedItem = data.Data.ImageURI;
            //ImagePic.ItemsSource = CharacterService.CharacterURIs;



            PrimaryHandPic.ItemsSource = new List <ItemModel>(ItemIndexViewModel.Instance.Dataset.Where(a => a.Location == ItemLocationEnum.PrimaryHand));

            HeadPic.ItemsSource = new List <ItemModel>(ItemIndexViewModel.Instance.Dataset.Where(a => a.Location == ItemLocationEnum.Head));

            NecklacePic.ItemsSource = new List <ItemModel>(ItemIndexViewModel.Instance.Dataset.Where(a => a.Location == ItemLocationEnum.Necklass));

            OffHandPic.ItemsSource = new List <ItemModel>(ItemIndexViewModel.Instance.Dataset.Where(a => a.Location == ItemLocationEnum.OffHand));

            RightFingerPic.ItemsSource = new List <ItemModel>(ItemIndexViewModel.Instance.Dataset.Where(a => a.Location == ItemLocationEnum.RightFinger));

            LeftFingerPic.ItemsSource = new List <ItemModel>(ItemIndexViewModel.Instance.Dataset.Where(a => a.Location == ItemLocationEnum.LeftFinger));

            FeetPic.ItemsSource = new List <ItemModel>(ItemIndexViewModel.Instance.Dataset.Where(a => a.Location == ItemLocationEnum.Feet));
        }
 public ActionResult GetView(string URL)
 {
     WebFetch wFetch = new WebFetch();
     GenericViewModel Model = new GenericViewModel();
     Model.DisplayString = wFetch.GetView(URL);
     return PartialView("RefreshView",Model);
 }
        /// <summary>
        /// Constructor called with a view model
        /// This is the primary way to open the page
        /// The viewModel is the data that should be displayed
        /// </summary>
        /// <param name="viewModel"></param>
        public MonsterReadPage(GenericViewModel <MonsterModel> data)
        {
            InitializeComponent();

            BindingContext = this.ViewModel = data;
            AddItemsToDisplay();
        }
Exemple #14
0
        public async Task EnviaEmail(GenericViewModel model, ViewAsPdf pdfView)
        {
            var emailcliente = new System.Net.Mail.MailAddress(daoClientes.buscarCliente(model.idCliente.ToString()).email);

            model.User         = new UsuariosDAO().LoginEmailApp("", User.Identity.GetUserId().ToString());
            model.EmailCliente = emailcliente.ToString();

            await CreateLogAsync(model);



            var copia = String.IsNullOrWhiteSpace(model.EmailCopia) ? null : new System.Net.Mail.MailAddress(model.EmailCopia);
            var pdf   = pdfView.BuildPdf(ControllerContext);


            string de = new UsuariosDAO().LoginEmailApp("", User.Identity.GetUserId()).Email;

            var assinatura = " <div style=\"height:150; width:529px; padding:0px; background:url(http://bobson.kinghost.net/Images/AssinaturaNova.png) no-repeat white\">  " +
                             "     <div> <p align=\"Right\" style=\"padding: 30\"><br><font size=\"3\" color=\"black\">" + model.User.Nome + "</font> " +
                             " <br> <font size=\"1\" color=\"black\"> " + model.User.Cargo + " </font> <br>" +
                             " <font size=\"1\" color=\"black\">Telefones + 55 " + model.User.TelefoneCelular + " <br> " + model.User.TelefoneComercial + "</font>" +
                             " <br> <br>" +
                             " <br> </p> </div> </div> <br>";

            model.CorpoEmail += assinatura;

            await ServicosLocais.EnviaEmailProposta(emailcliente, copia, model.TituloEmail, model.CorpoEmail, "PropostaBobsonLatinAmerica.pdf", pdf, de);
        }
Exemple #15
0
        private Task CreateLogAsync(GenericViewModel model)
        {
            var dao = new ArosDAO();
            var dto = new HistoricoPropostaDTO();

            model.User       = new UsuariosDAO().LoginEmailApp("", User.Identity.GetUserId().ToString());
            dto.EmailAssunto = model.TituloEmail;
            dto.EmailCliente = model.EmailCliente;
            dto.EmailCopia   = model.EmailCopia;
            dto.EmailCorpo   = model.CorpoEmail;
            dto.ViewName     = model.ViewName;
            dto.ViewModel    = model.ToString();
            dto.UsuarioId    = User.Identity.GetUserId();
            dto.Proposta     = model.CamposTexto_30;

            AtendimentoDAO atendimentoDAO = new AtendimentoDAO();

            AtendimentoClienteDTO atendimentoClienteDTO = new AtendimentoClienteDTO();

            atendimentoClienteDTO.UsuarioId         = User.Identity.GetUserId();
            atendimentoClienteDTO.tipo              = "3";
            atendimentoClienteDTO.dataContato       = DateTime.Now;
            atendimentoClienteDTO.dataVisita        = DateTime.Now;
            atendimentoClienteDTO.obs               = "Orcamento enviado por email :" + model.EmailCliente;
            atendimentoClienteDTO.idCliente         = model.idCliente;
            atendimentoClienteDTO.idTipoAtendimento = 3;
            atendimentoClienteDTO.idVendedor        = User.Identity.GetUserId();
            atendimentoDAO.Salvar(atendimentoClienteDTO);



            dao.SalvarHistoricoProposta(dto);

            return(Task.FromResult(true));
        }
        /// <summary>
        /// Constructor called with a view model
        /// This is the primary way to open the page
        /// The viewModel is the data that should be displayed
        /// </summary>
        /// <param name="viewModel"></param>
        public CharacterReadPage(GenericViewModel <CharacterModel> data)
        {
            InitializeComponent();

            BindingContext = this.ViewModel = data;

            LoadValues(data);
        }
Exemple #17
0
        public ActionResult GetView(string URL)
        {
            WebFetch         wFetch = new WebFetch();
            GenericViewModel Model  = new GenericViewModel();

            Model.DisplayString = wFetch.GetView(URL);
            return(PartialView("RefreshView", Model));
        }
        // Handle Monster death
        public PersonDiePage(GenericViewModel <MonsterModel> monster)
        {
            InitializeComponent();

            monster.Data = new MonsterModel();

            BindingContext = this.MonsterViewModel = monster;
        }
        // Handle Character death
        public PersonDiePage(GenericViewModel <CharacterModel> character)
        {
            InitializeComponent();

            character.Data = new CharacterModel();

            BindingContext = this.CharacterViewModel = character;
        }
Exemple #20
0
 public ActionResult StartView(string id, GenericViewModel model)
 {
     model               = new GenericViewModel();
     model.ViewName      = id.Replace("_edt", "_pnt");
     model.listaClientes = daoClientes.ListarClientes(User.Identity.GetUserId());
     model.User          = new UsuariosDAO().LoginEmailApp("", User.Identity.GetUserId().ToString());
     return(View(id, model));
 }
Exemple #21
0
        // Constructor for Delete takes a view model of what to delete
        public ItemDeletePage(GenericViewModel <ItemModel> data)
        {
            InitializeComponent();

            BindingContext = this.viewModel = data;

            this.viewModel.Title = data.Title;
        }
        public CharacterDeletePage(GenericViewModel <CharacterModel> data)
        {
            InitializeComponent();

            BindingContext = this.viewModel = data;

            this.viewModel.Title = "Delete " + data.Title;
        }
        /// <summary>
        /// Constructor for CharacterUpdatePage by taking a view model of character to update
        /// </summary>
        /// <param name="data"></param>
        public CharacterUpdatePage(GenericViewModel <CharacterModel> data)
        {
            InitializeComponent();

            BindingContext = this.ViewModel = data;

            AbilityPicker.SelectedItem = data.Data.Ability.ToString();
        }
        ///// <summary>
        ///// Constructor for Index Page
        /////
        ///// Get the ItemIndexView Model
        ///// </summary>
        //public CharacterImageChangePage()
        //{
        //    InitializeComponent();

        //    //BindingContext = ViewModel;
        //}

        public CharacterImageChangePage(GenericViewModel <CharacterModel> viewModel)
        {
            this.viewModel = viewModel;

            InitializeComponent();

            // BindingContext = ViewModel;
        }
        /// <summary>
        /// Constructor that takes and existing data Score
        /// </summary>
        public ScoreUpdatePage(GenericViewModel <ScoreModel> data)
        {
            InitializeComponent();

            BindingContext = this.ViewModel = data;

            this.ViewModel.Title = "Update " + data.Title;
        }
Exemple #26
0
        //constructor
        public CharacterEquiped(GenericViewModel <BaseCharacter> data)
        {
            InitializeComponent();
            BindingContext = this.ViewModel = data;


            AddItemsToDisplay();
        }
Exemple #27
0
        // Constructor for Delete takes a view model of what to delete
        public MonsterDeletePage(GenericViewModel <MonsterModel> data)
        {
            InitializeComponent();

            BindingContext = this.viewModel = data;

            this.viewModel.Title = "Monster Delete";
        }
Exemple #28
0
        /// <summary>
        /// Constructor called with a view model
        /// This is the primary way to open the page
        /// The viewModel is the data that should be displayed
        /// </summary>
        /// <param name="viewModel"></param>
        public MonsterReadPage(GenericViewModel <MonsterModel> data)
        {
            InitializeComponent();

            BindingContext  = this.ViewModel = data;
            Item1Label.Text = ItemIndexViewModel.Instance.GetItemNameById(data.Data.ItemPocket1);
            Item2Label.Text = ItemIndexViewModel.Instance.GetItemNameById(data.Data.ItemPocket2);
            Item3Label.Text = ItemIndexViewModel.Instance.GetItemNameById(data.Data.ItemPocket3);
        }
Exemple #29
0
        /// <summary>
        /// Constructor called with a view model
        /// This is the primary way to open the page
        /// The viewModel is the data that should be displayed
        /// </summary>
        /// <param name="viewModel"></param>
        public CharacterReadPage(GenericViewModel <CharacterModel> data)
        {
            InitializeComponent();

            BindingContext = this.ViewModel = data;

            // Display the item names
            //DisplayItemNames();
        }
        /// <summary>
        /// Constructor called with a view model
        /// This is the primary way to open the page
        /// The viewModel is the data that should be displayed
        /// </summary>
        /// <param name="viewModel"></param>
        public MonsterReadPage(GenericViewModel <BaseMonster> data)
        {
            InitializeComponent();

            BindingContext = this.ViewModel = data;
            List <string> strengths = StrengthWeaknessHelper.getMonsterStrengths(ViewModel.Data.Attribute.ToString());

            StrengthListView.ItemsSource = strengths;
        }
    private void OnGenericViewRequested(GenericViewModel viewModel)
    {
        var handler = GenericViewRequested;

        if (handler != null)
        {
            handler(this, new GenericViewRequestedEventArgs(viewModel));
        }
    }