Beispiel #1
0
        private void ButtonEnviar_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (IsDatosContactanosValidos())
            {
                using (var repository = new DatosContactosRepository())
                {
                    DatosContacto newContacto = new DatosContacto()
                    {
                        Comentario   = this.TextBoxComentario.Text,
                        Email        = this.TextBoxEmail.Text,
                        Destinatario = "Siescom Publicidad",
                        Nombre       = this.TextBoxNombre.Text,
                        Telefono     = this.TextBoxTelefono.Text
                    };
                    repository.Add(newContacto);
                    Container.Resolve <MailService>().SendMailFromContactanos(
                        newContacto.Email, newContacto.Destinatario, newContacto.Nombre,
                        newContacto.Telefono, newContacto.Comentario);
                }

                this.FormularioPanel.Visibility        = System.Windows.Visibility.Collapsed;
                this.FormularioEnviadoPanel.Visibility = System.Windows.Visibility.Visible;
                this.touchKeyboard.Visibility          = System.Windows.Visibility.Hidden;
            }
            else
            {
                errorWnd = this.Container.Resolve <Views.DialogWindow>();
                errorWnd.ShowErrorFormulario();
            }
        }
Beispiel #2
0
 private static void SetButtonsClickEvents(Button save, Button cancel, Views.DialogWindow dialogWindow, TextBox fileName, TextBox extension, CheckBox hidden, string path)
 {
     cancel.Click += delegate
     {
         dialogWindow.Close();
     };
     save.Click += delegate
     {
         FileInfo     fileInfo     = new FileInfo(path);
         FileSecurity fileSecurity = fileInfo.GetAccessControl();
         string       user         = System.Environment.UserName;
         fileSecurity.AddAccessRule(new FileSystemAccessRule(user, FileSystemRights.FullControl, AccessControlType.Allow));
         fileInfo.SetAccessControl(fileSecurity);
         FileProperties file = new FileProperties()
         {
             CheckboxName = fileInfo.FullName,
             FileName     = fileInfo.Name,
             CreatedTime  = fileInfo.CreationTime,
             Size         = System.String.Format("{0}KB", fileInfo.Length / 1024),
         };
         file.GetFileName(path);
         file.SetExtension(extension.Text, path);
         if (hidden.IsChecked == true)
         {
             file.isHidden = true;
         }
         else
         {
             file.isHidden = false;
         }
         file.HideFile(path);
         file.ChangeName(fileName.Text, path);
         dialogWindow.Close();
     };
 }
        public static void ShowDialogWithText(string path)
        {
            var dialogWindow = new Views.DialogWindow();

            CreateLayout(dialogWindow.MainGrid, path);
            dialogWindow.SizeToContent = SizeToContent.WidthAndHeight;
            dialogWindow.ShowDialog();
        }
Beispiel #4
0
        public static void ShowDialogWindowWithAttributes(string FullName, string fileName, string extension, bool hidden)
        {
            var dialogWindow = new Views.DialogWindow();

            CreateGridLayout(dialogWindow.MainGrid);
            PopulateGrid(dialogWindow.MainGrid, fileName, extension, hidden, dialogWindow, FullName);
            dialogWindow.SizeToContent = SizeToContent.WidthAndHeight;
            dialogWindow.ShowDialog();
        }
        private void ButtonReclamarCupon_Click(object sender, RoutedEventArgs e)
        {
            string cedula = this.TextBoxCedulaIdentidad.Text;

            if (this.RadioButtonCedulaFirstLetter.IsChecked.Value)
            {
                cedula = "V" + this.TextBoxCedulaIdentidad.Text;
            }
            else
            {
                cedula = "E" + this.TextBoxCedulaIdentidad.Text;
            };
            Usuario newUsuario = new Usuario
            {
                Cedula = cedula,
                Nombre = this.TextBoxNombreApellido.Text,
                Movil  = this.TextBoxCodigoMovil.Text + this.TextBoxNumeroMovil.Text
            };

            if (!newUsuario.IsValido())
            {
                errorWnd = this.Container.Resolve <Views.DialogWindow>();
                errorWnd.ShowErrorDatosUsuario();
                return;
            }

            wndConfirmacion       = new CuponConfirmacionWindow();
            wndConfirmacion.Owner = Application.Current.MainWindow;
            wndConfirmacion.TextNombreUsuario.Text = this.TextBoxNombreApellido.Text;
            wndConfirmacion.TextBoxCedula.Text     = cedula;
            if (!string.IsNullOrEmpty(this.TextBoxCodigoMovil.Text))
            {
                wndConfirmacion.TextBoxMovil.Text = String.Format("{0}.{1}.{2}.{3}",
                                                                  this.TextBoxCodigoMovil.Text,
                                                                  this.TextBoxNumeroMovil.Text.Substring(0, 3),
                                                                  this.TextBoxNumeroMovil.Text.Substring(3, 2),
                                                                  this.TextBoxNumeroMovil.Text.Substring(5, 2));
            }
            TimerService.Start();
            if (wndConfirmacion.ShowDialog() == true)
            {
                wndConfirmacionCondiciones = new CuponCondicionesUsoWindow(
                    ((DatosClienteViewModel)this.DataContext).PromocionSelected.Condiciones);
                wndConfirmacionCondiciones.Owner = Application.Current.MainWindow;
                TimerService.Start();
                if (wndConfirmacionCondiciones.ShowDialog() == true)
                {
                    ((DatosClienteViewModel)this.DataContext).ReclamarCuponCommand.Execute(newUsuario);
                }
            }
        }
        private void ButtonReclamarCupon_Click(object sender, RoutedEventArgs e)
        {
            Promocion promocion = ((Button)sender).DataContext as Promocion;

            ((DatosClienteViewModel)this.DataContext).PromocionSelected = promocion;

            if (!promocion.HasCuponesDisponibles)
            {
                //no aceptado
                errorWnd = this.Container.Resolve <Views.DialogWindow>();
                errorWnd.ShowErrorPromocion(string.Empty);
            }
            else
            {
                this.RegionManager.RequestNavigate(RegionNames.REGION_WORK_AREA,
                                                   new Uri("CuponesLoginView", UriKind.Relative));
            }
        }
Beispiel #7
0
 /// <summary>
 /// Command's action to display new dialog to add text
 /// </summary>
 private void ShowAddTextDialog()
 {
     Views.DialogWindow _dialogWindow = new Views.DialogWindow();
     _dialogWindow.ShowDialog();
 }
 void CuponesLoginView_OnPromocionNoAprobada(object sender, string e)
 {
     //no aceptado
     errorWnd = this.Container.Resolve <Views.DialogWindow>();
     errorWnd.ShowErrorPromocion(e);
 }
Beispiel #9
0
        private static void PopulateGrid(Grid grid, string fileName, string extension, bool hidden, Views.DialogWindow dialogWindow, string FullName)
        {
            Label label1 = new Label();
            Label label2 = new Label();
            Label label3 = new Label();

            label1.Content = "File Name";
            label2.Content = "Extension";
            label3.Content = "Hidden";
            TextBox fileNameBox = new TextBox();

            fileNameBox.Text = fileName;
            TextBox extensionBox = new TextBox();

            extensionBox.Text = extension;
            CheckBox hiddenBox = new CheckBox();

            if (hidden)
            {
                hiddenBox.IsChecked = true;
            }
            else
            {
                hiddenBox.IsChecked = false;
            }
            Button saveButton   = new Button();
            Button cancelButton = new Button();

            saveButton.Content   = "save";
            cancelButton.Content = "cancel";
            SetButtonsClickEvents(saveButton, cancelButton, dialogWindow, fileNameBox, extensionBox, hiddenBox, FullName);
            Grid.SetRow(saveButton, 3);
            Grid.SetColumn(saveButton, 1);
            Grid.SetRow(cancelButton, 3);
            Grid.SetColumn(cancelButton, 3);
            Grid.SetRow(label1, 1);
            Grid.SetColumn(label1, 1);
            Grid.SetRow(label2, 1);
            Grid.SetColumn(label2, 2);
            Grid.SetRow(label3, 1);
            Grid.SetColumn(label3, 3);
            Grid.SetRow(fileNameBox, 2);
            Grid.SetColumn(fileNameBox, 1);
            Grid.SetRow(extensionBox, 2);
            Grid.SetColumn(extensionBox, 2);
            Grid.SetRow(hiddenBox, 2);
            Grid.SetColumn(hiddenBox, 3);
            grid.Children.Add(fileNameBox);
            grid.Children.Add(extensionBox);
            grid.Children.Add(hiddenBox);
            grid.Children.Add(label1);
            grid.Children.Add(label2);
            grid.Children.Add(label3);
            grid.Children.Add(saveButton);
            grid.Children.Add(cancelButton);
        }