예제 #1
0
 public frmFormatoView(FormatModel pe_FormatModel)
 {
     InitializeComponent();
     pe_ConnectionFormat = new ConnectionReport();
     ps_FormatModel      = pe_FormatModel;
     pb_Load();
 }
예제 #2
0
 public EditorViewModel(DocumentModel document)
 {
     Document      = document;
     Format        = new FormatModel();
     FormatCommand = new RelayCommand(OpenStyleDialog);
     WrapCommand   = new RelayCommand(ToggleWrap);
 }
예제 #3
0
    public void Display_UsesTemplateFormatted(FormatModel model, string expectedResult)
    {
        // Arrange
        var view = new Mock <IView>();

        view.Setup(v => v.RenderAsync(It.IsAny <ViewContext>()))
        .Callback((ViewContext v) => v.Writer.WriteAsync(v.ViewData.TemplateInfo.FormattedModelValue.ToString()))
        .Returns(Task.FromResult(0));
        var viewEngine = new Mock <ICompositeViewEngine>(MockBehavior.Strict);

        viewEngine
        .Setup(v => v.GetView(/*executingFilePath*/ null, It.IsAny <string>(), /*isMainPage*/ false))
        .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty <string>()));
        viewEngine
        .Setup(v => v.FindView(It.IsAny <ActionContext>(), "DisplayTemplates/Status", /*isMainPage*/ false))
        .Returns(ViewEngineResult.Found("Status", view.Object))
        .Verifiable();
        var helper = DefaultTemplatesUtilities.GetHtmlHelper(model, viewEngine.Object);

        // Act
        var displayResult = helper.DisplayFor(x => x.FormatProperty);

        // Assert
        Assert.Equal(expectedResult, HtmlContentUtilities.HtmlContentToString(displayResult));
    }
 public EditorViewModel(DocumentModel document)
 {
     Document      = document;
     Format        = new FormatModel();
     FormatCommand = new RelayCommand(OpenStyleDialog);
     QuoteCommand  = new RelayCommand(SetQuoteText);
 }
예제 #5
0
        internal static IList <FormatModel> ConvertEntitiesToModels(IList <Format> formats)
        {
            IList <FormatModel> formatsModels = new List <FormatModel>();

            foreach (Format format in formats)
            {
                formatsModels.Add(FormatModel.ToModel(format));
            }
            return(formatsModels);
        }
 public void TestInitialize()
 {
     styleClass  = Utils.CreateStyleClassForTest();
     format      = Utils.CreateFormatForTest();
     formatModel = FormatModel.ToModel(format);
     mockUserAuthorizationLogic = new Mock <IAuthorizationBusinessLogic>();
     mockFormatsBusinessLogic   = new Mock <IFormatBusinessLogic>();
     formatController           = new FormatController(mockFormatsBusinessLogic.Object, mockUserAuthorizationLogic.Object);
     InitializeToken();
 }
예제 #7
0
 public EditorViewModel(DocumentModel document)
 {
     Document = document;
     Format   = new FormatModel()
     {
         Family = new FontFamily("Consolas"), Size = 12
     };
     FormatCommand        = new RelayCommand(OpenFormatDialog);
     WrapCommand          = new RelayCommand(ToggleWrap);
     ZoomInEditorCommand  = new RelayCommand(ZoomInEditor);
     ZoomOutEditorCommand = new RelayCommand(ZoomOutEditor);
 }
 private void Btn_AddFormatSave_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(TxtBx_FormatName.Text))
     {
         MessageBox.Show("Please enter a Format name before clicking the Save button.");
     }
     else
     {
         FormatModel format = new FormatModel(TxtBx_FormatName.Text);
         format.AddToDb();
         Close();
     }
 }
 public IHttpActionResult Post([FromBody] FormatModel formatModel)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         Utils.HasAdminPermissions(Request, AuthorizationBusinessLogic);
         FormatBusinessLogic.Add(formatModel.ToEntity());
         return(Ok(formatModel));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
 public IHttpActionResult Get([FromUri] Guid id)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         Utils.HasAdminPermissions(Request, AuthorizationBusinessLogic);
         Format format = FormatBusinessLogic.Get(id);
         return(Ok(FormatModel.ToModel(format)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
 public IHttpActionResult Put([FromUri] Guid id, [FromBody] FormatModel formatModel)
 {
     try
     {
         formatModel.Id = id;
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         Utils.HasAdminPermissions(Request, AuthorizationBusinessLogic);
         FormatBusinessLogic.Modify(formatModel.ToEntity());
         return(Ok("Format Modified"));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
예제 #12
0
        public EditorViewModel(DocumentModel document)
        {
            Document      = document;
            Format        = new FormatModel();
            FormatCommand = new RelayCommand(OpenStyleDialog);
            WrapCommand   = new RelayCommand(ToggleWrap);

            if (App._formatModel != null)
            {
                Format = App._formatModel;
            }

            App._documentModel = document;
            App._formatModel   = Format;
        }
예제 #13
0
 private void mlnkImprimir_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(pe_TransaccionEncabezadoModel.traChrNumero))
     {
         vMensajeView.pb_MensajeSistema(this, 3, "Debe seleccionar un registro.");
     }
     else
     {
         var format         = new FormatModel(pe_TransaccionEncabezadoModel.empIntCodigo, pe_TransaccionEncabezadoModel.traChrNumero, "CLIVEN", "COM", "001", pe_TransaccionEncabezadoModel.traChrEstado, "");
         var frmFormatoView = new frmFormatoView(format);
         if (frmFormatoView.ps_status)
         {
             frmFormatoView.Show();
         }
         else
         {
             vMensajeView.pb_MensajeSistema(this, 3, frmFormatoView.ps_mensaje);
         }
     }
     pe_TransaccionEncabezadoModel = new TransaccionEncabezadoModel();
 }
        public void integration()
        {
            var                         requestMessage = new HttpRequestMessage();
            IUserDataAccess             da             = new UserDataAccess();
            IUserBusinessLogic          userBL         = new UserBusinessLogic(new UserDataAccess());
            IAuthorizationBusinessLogic auth           = new AuthorizationBusinessLogic(da);
            IStyleDataAccess            styleDA        = new StyleDataAccess();
            IStyleBusinessLogic         styleBL        = new StyleBusinessLogic(styleDA);
            IStyleClassDataAccess       styleClassDA   = new StyleClassDataAccess();
            IStyleClassBusinessLogic    styleClassBL   = new StyleClassBusinessLogic(styleClassDA, styleBL);
            IFormatDataAccess           formatDA       = new FormatDataAccess();
            IFormatBusinessLogic        formatBL       = new FormatBusinessLogic(formatDA, styleClassBL);
            FormatController            formatC        = new FormatController(formatBL, auth);

            formatC.Request = requestMessage;
            StyleClass  styleClassA  = Utils.CreateStyleClassInDataBaseForTest();
            Format      formatA      = Utils.CreateFormatForTest();
            FormatModel formatModelA = FormatModel.ToModel(formatA);

            formatC.Post(formatModelA);
            formatC.AddStyleClassToFormat(formatA.Id, StyleClassModel.ToModel(styleClassA));
            IHttpActionResult statusObtained = formatC.Get(formatA.Id);
            int a = 2;
        }
        public void IntegrationTest()
        {
            Guid token          = Guid.NewGuid();
            var  requestMessage = new HttpRequestMessage();

            requestMessage.Headers.Add("Token", token + "");
            mockUserAuthorizationLogic.Setup(b1 => b1.IsAValidToken(token)).Returns(true);
            mockUserAuthorizationLogic.Setup(b1 => b1.IsAdmin(token)).Returns(true);

            IStyleDataAccess         styleDA      = new StyleDataAccess();
            IStyleBusinessLogic      styleBL      = new StyleBusinessLogic(styleDA);
            IStyleClassDataAccess    styleClassDA = new StyleClassDataAccess();
            IStyleClassBusinessLogic styleClassBL = new StyleClassBusinessLogic(styleClassDA, styleBL);
            IFormatDataAccess        formatDA     = new FormatDataAccess();
            IFormatBusinessLogic     formatBL     = new FormatBusinessLogic(formatDA, styleClassBL);
            FormatController         formatC      = new FormatController(formatBL, mockUserAuthorizationLogic.Object);

            formatC.Request = requestMessage;

            Format      formatA      = Utils.CreateFormatForTest();
            FormatModel formatModelA = FormatModel.ToModel(formatA);

            formatC.Post(formatModelA);
        }
예제 #16
0
        private void pv_GuardarFactura(object sender, EventArgs e)
        {
            try
            {
                ValidarControles validarControles = new ValidarControles();

                if (validarControles.pb_ValidarControles(this))
                {
                    if (pv_ValidarEncabezadoTransac())
                    {
                        // Carga el modelo de encabezado de la transaccion con los datos ingresados.
                        pv_CargarEncabezadoTransac();

                        if (pv_ValidarCliente())
                        {
                            pv_ActualizarTotales();

                            if (pv_ValidarDetalleTransac())
                            {
                                pv_CargarDetalleProductos();

                                if (pv_BuscarMediosPago())
                                {
                                    pe_TransaccionEncabezadoModel.pb_GuardarTransaccion(pe_TransaccionEncabezadoModel, pe_DetalleMedioPagoModel, pe_DetalleProductoModel, ref ps_Estado, ref ps_Mensaje);
                                    if (ps_Estado != null && ps_Estado.Value)
                                    {
                                        var format         = new FormatModel(pe_TransaccionEncabezadoModel.empIntCodigo, pe_TransaccionEncabezadoModel.traChrNumero, "CLIVEN", "COM", "001", pe_TransaccionEncabezadoModel.traChrEstado, "");
                                        var frmFormatoView = new frmFormatoView(format);
                                        if (frmFormatoView.ps_status)
                                        {
                                            vMensajeView.pb_MensajeSistema(this, 1, "Transacción almacenada con exito.");
                                            frmFormatoView.Show();
                                            Close();
                                            frmFacturaMant vFrmFacturaMant = new frmFacturaMant(frmOrigen);
                                            vFrmFacturaMant.Show();
                                        }
                                        else
                                        {
                                            vMensajeView.pb_MensajeSistema(this, 3, frmFormatoView.ps_mensaje);
                                        }
                                    }
                                }
                                else
                                {
                                    vMensajeView.pb_MensajeSistema(this, 3, "No se han asigando medios de pago a la factura");
                                }
                            }
                            else
                            {
                                vMensajeView.pb_MensajeSistema(this, 3, ps_Mensaje);
                            }
                        }
                        else
                        {
                            vMensajeView.pb_MensajeSistema(this, 3, ps_Mensaje);
                        }
                    }
                    else
                    {
                        vMensajeView.pb_MensajeSistema(this, 3, ps_Mensaje);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #17
0
 public EditorViewModel(DocumentModel _document)
 {
     Document = _document;
     Format   = new FormatModel();
     OpenFontDialogCommand = new CommandClick(OpenFontDialog);
 }
예제 #18
0
 public FileItemViewModel()
 {
     DocumentFormat = new FormatModel();
     Document       = new DocumentModel();
 }