/// <summary>
        /// Validate single attribute of an entity.
        /// </summary>
        /// <param name="entity">Entity</param>
        /// <param name="attribute">Name of attribute to be validated</param>
        /// <returns>true, if attribute value is valid; false, otherwise.</returns>
        public bool Validate(Entity entity, string attribute)
        {
            Asset asset = V1Instance.GetAsset(entity.InstanceKey) ?? V1Instance.GetAsset(entity);
            IAttributeDefinition attributeDefinition = asset.AssetType.GetAttributeDefinition(attribute);

            return(validator.Validate(asset, attributeDefinition));
        }
Example #2
0
        public override bool RequiredFieldsValidator(Persistent persistentObject, ErrorMessages messages)
        {
            bool     result  = base.RequiredFieldsValidator(persistentObject, messages);
            Clientes cliente = persistentObject as Clientes;
            RequiredFieldValidator requiredValidator = new RequiredFieldValidator(messages);

            result &= requiredValidator.Validate(cliente.Nombre, "Debe ingresar un Nombre");
            result &= requiredValidator.Validate(cliente.CUIT, "Debe ingresar un CUIT");
            result &= requiredValidator.Validate(cliente.TipoPago, "Debe ingresar un Tipo de Pago");
            result &= requiredValidator.Validate(cliente.TipoContribuyente, "Debe ingresar un Tipo de Contribuyente");
            result &= requiredValidator.Validate(cliente.Email, "Debe ingresar el Email");
            return(result);
        }
Example #3
0
        public override bool RequiredFieldsValidator(Persistent persistentObject, ErrorMessages messages)
        {
            bool result = base.RequiredFieldsValidator(persistentObject, messages);
            ComprobantesCompras comprobante = persistentObject as ComprobantesCompras;

            ActualizarCamposImportacion(comprobante);

            RequiredFieldValidator requiredValidator = new RequiredFieldValidator(messages);

            result &= requiredValidator.Validate(comprobante.Tipo, "Debe ingresar un Tipo");
            result &= requiredValidator.Validate(comprobante.NombreProveedor, "Debe ingresar el nombre del Proveedor");
            result &= requiredValidator.Validate(comprobante.CUITProveedor, "Debe ingresar el CUIT del Proveedor");
            result &= requiredValidator.Validate(comprobante.CAIProveedor, "Debe ingresar el CAI del Proveedor");
            result &= requiredValidator.Validate(comprobante.TipoProveedor, "Debe ingresar el Tipo de Contribuyente del Proveedor");
            result &= new NoComprobanteValidator(messages).Validate(comprobante.Numero, "Debe ingresar un Número de Comprobante");
            if (comprobante.Importacion)
            {
                result &= requiredValidator.Validate(comprobante.Destinacion, "Debe ingresar una Destinación");
                result &= requiredValidator.Validate(comprobante.Aduana, "Debe ingresar una Aduana");
                result &= requiredValidator.Validate(comprobante.NumeroDespacho, "Debe ingresar un Número de Despacho");
                if (comprobante.FechaDespacho == null)
                {
                    result = false;
                    messages.Add("Debe ingresar una fecha de despacho");
                }
            }
            return(result);
        }
Example #4
0
        protected void gvWorkstations_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            TextBox                    n       = this.gvWorkstations.Rows[gvWorkstations.EditIndex].Cells[0].FindControl("txtWorkstationName") as TextBox;
            TextBox                    mac     = this.gvWorkstations.Rows[gvWorkstations.EditIndex].Cells[0].FindControl("txtMACAddress") as TextBox;
            DropDownList               o       = this.gvWorkstations.Rows[gvWorkstations.EditIndex].Cells[0].FindControl("ddlOS") as DropDownList;
            RequiredFieldValidator     rfvName = this.gvWorkstations.Rows[gvWorkstations.EditIndex].Cells[0].FindControl("rfvClassroomName") as RequiredFieldValidator;
            RequiredFieldValidator     rfvMac  = this.gvWorkstations.Rows[gvWorkstations.EditIndex].Cells[0].FindControl("rfvMAC") as RequiredFieldValidator;
            RegularExpressionValidator revMac  = this.gvWorkstations.Rows[gvWorkstations.EditIndex].Cells[0].FindControl("revMAC") as RegularExpressionValidator;

            rfvName.Validate();
            rfvMac.Validate();
            revMac.Validate();

            if (rfvName.IsValid && rfvMac.IsValid && revMac.IsValid)
            {
                Workstation w = new Workstation();
                w.edit(Convert.ToInt32(e.Keys[0].ToString()), n.Text, mac.Text, Convert.ToInt32(ddlClassroom.SelectedValue), 0, Convert.ToInt32(o.SelectedValue));

                lblText.Text              = "<br />Record modified successfully<br />";
                gvWorkstations.EditIndex  = -1;
                gvWorkstations.DataSource = w.load(Convert.ToInt32(this.ddlClassroom.SelectedValue));
                gvWorkstations.DataBind();

                this.gvWorkstations.ShowFooter = false;
                btnInsert.Visible = true;
            }
        }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "NewRecord")
     {
         reqNAME.Enabled = true;
         reqNAME.Validate();
         if (Page.IsValid)
         {
             Guid gID = Guid.Empty;
             try
             {
                 SqlProcs.spPROSPECT_LISTS_New(ref gID, txtNAME.Text);
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                 lblError.Text = ex.Message;
             }
             if (!Sql.IsEmptyGuid(gID))
             {
                 Response.Redirect("~/ProspectLists/view.aspx?ID=" + gID.ToString());
             }
         }
     }
 }
Example #6
0
 public virtual void Validate()
 {
     if (Required && Enabled)
     {
         m_RequiredFieldValidator.Validate();
     }
 }
        private void butBuscarVuelta_Click(object sender, System.EventArgs e)
        {
            RequiredFieldValidator reqFechaServicioVuelta = (RequiredFieldValidator)this.phValidFechaServicioVuelta.FindControl("reqFechaVuelta");

            reqFechaServicioVuelta.Enabled = true;
            reqFechaServicioVuelta.Validate();
            if (!reqFechaServicioVuelta.IsValid)
            {
                return;
            }

            BaseValidator validFechaServicioVuelta = (BaseValidator)this.phValidFechaServicioVuelta.FindControl("validFechaVuelta");

            validFechaServicioVuelta.Enabled = true;
            validFechaServicioVuelta.Validate();
            if (!validFechaServicioVuelta.IsValid)
            {
                return;
            }

            RequiredFieldValidator reqOrigenVuelta = (RequiredFieldValidator)this.phValidOrigenVuelta.FindControl("validOrigenVuelta");

            reqOrigenVuelta.Enabled = true;
            reqOrigenVuelta.Validate();
            if (!reqOrigenVuelta.IsValid)
            {
                return;
            }

            this.LlenarComboServicioVuelta();
        }
        private void ddlDestinoIda_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            RequiredFieldValidator reqFechaServicioIda = (RequiredFieldValidator)this.phValidFechaServicioIda.FindControl("reqFechaIda");

            reqFechaServicioIda.Enabled = true;
            reqFechaServicioIda.Validate();
            if (!reqFechaServicioIda.IsValid)
            {
                return;
            }

            BaseValidator validFechaServicioIda = (BaseValidator)this.phValidFechaServicioIda.FindControl("validFechaIda");

            validFechaServicioIda.Enabled = true;
            validFechaServicioIda.Validate();
            if (!validFechaServicioIda.IsValid)
            {
                return;
            }

            RequiredFieldValidator reqOrigenIda = (RequiredFieldValidator)this.phValidOrigenIda.FindControl("validOrigenIda");

            reqOrigenIda.Enabled = true;
            reqOrigenIda.Validate();
            if (!reqOrigenIda.IsValid)
            {
                return;
            }

            this.LlenarComboServicioIda();
        }
Example #9
0
        public void ShouldReturnFalseForReferenceType()
        {
            object    testValue = new object();
            Validator requiredFieldValidator = new RequiredFieldValidator(testValue);

            Assert.IsFalse(requiredFieldValidator.Validate());
        }
Example #10
0
        public void ShouldReturnFalseForWhitespaceString()
        {
            string    testValue = "";
            Validator requiredFieldValidator = new RequiredFieldValidator(testValue);

            Assert.IsFalse(requiredFieldValidator.Validate());
        }
Example #11
0
        public void ShouldReturnFalseForEmptyString()
        {
            string    testValue = string.Empty;
            Validator requiredFieldValidator = new RequiredFieldValidator(testValue);

            Assert.IsFalse(requiredFieldValidator.Validate());
        }
Example #12
0
        public void ShouldReturnTrueForStringType()
        {
            string    testValue = "Some string";
            Validator requiredFieldValidator = new RequiredFieldValidator(testValue);

            Assert.IsTrue(requiredFieldValidator.Validate());
        }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "NewRecord")
     {
         reqNAME.Enabled = true;
         //reqPHONE_OFFICE.Enabled = true;  // 07/16/2005 Paul.  Phone is not currently validated.
         reqNAME.Validate();
         reqPHONE_OFFICE.Validate();
         if (Page.IsValid)
         {
             Guid gID = Guid.Empty;
             try
             {
                 SqlProcs.spACCOUNTS_New(ref gID, txtNAME.Text, txtPHONE_OFFICE.Text, txtWEBSITE.Text);
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                 lblError.Text = ex.Message;
             }
             if (!Sql.IsEmptyGuid(gID))
             {
                 Response.Redirect("~/Accounts/view.aspx?ID=" + gID.ToString());
             }
         }
     }
 }
Example #14
0
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "NewRecord")
     {
         reqNAME.Enabled     = true;
         reqEND_DATE.Enabled = true;
         valEND_DATE.Enabled = true;
         reqNAME.Validate();
         reqEND_DATE.Validate();
         valEND_DATE.Validate();
         if (Page.IsValid)
         {
             Guid gID = Guid.Empty;
             try
             {
                 SqlProcs.spCAMPAIGNS_New(ref gID, txtNAME.Text, T10n.ToServerTime(ctlEND_DATE.Value), lstSTATUS.SelectedValue, lstCAMPAIGN_TYPE.SelectedValue);
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                 lblError.Text = ex.Message;
             }
             if (!Sql.IsEmptyGuid(gID))
             {
                 Response.Redirect("~/Campaigns/view.aspx?ID=" + gID.ToString());
             }
         }
     }
 }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "Save")
     {
         reqEMAILS_PER_RUN.Enabled = true;
         reqEMAILS_PER_RUN.Validate();
         if (Page.IsValid)
         {
             try
             {
                 int nEMAILS_PER_RUN = Sql.ToInteger(EMAILS_PER_RUN.Text);
                 Application["CONFIG.massemailer_campaign_emails_per_run"]         = (nEMAILS_PER_RUN > 0)        ? nEMAILS_PER_RUN.ToString() : String.Empty;
                 Application["CONFIG.massemailer_tracking_entities_location_type"] = SITE_LOCATION_CUSTOM.Checked ? "2"                        : String.Empty;
                 Application["CONFIG.massemailer_tracking_entities_location"]      = SITE_LOCATION_CUSTOM.Checked ? SITE_LOCATION.Text         : String.Empty;
                 SqlProcs.spCONFIG_Update("mail", "massemailer_campaign_emails_per_run", Sql.ToString(Application["CONFIG.massemailer_campaign_emails_per_run"]));
                 SqlProcs.spCONFIG_Update("mail", "massemailer_tracking_entities_location_type", Sql.ToString(Application["CONFIG.massemailer_tracking_entities_location_type"]));
                 SqlProcs.spCONFIG_Update("mail", "massemailer_tracking_entities_location", Sql.ToString(Application["CONFIG.massemailer_tracking_entities_location"]));
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                 ctlEditButtons.ErrorText = ex.Message;
                 return;
             }
             Response.Redirect("../default.aspx");
         }
     }
     else if (e.CommandName == "Cancel")
     {
         Response.Redirect("../default.aspx");
     }
 }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "NewRecord")
     {
         reqNAME.Enabled        = true;
         reqDATE_CLOSED.Enabled = true;
         reqACCOUNT_ID.Enabled  = true;
         reqAMOUNT.Enabled      = true;
         valDATE_CLOSED.Enabled = true;
         reqNAME.Validate();
         reqDATE_CLOSED.Validate();
         reqACCOUNT_ID.Validate();
         reqAMOUNT.Validate();
         valDATE_CLOSED.Validate();
         if (Page.IsValid)
         {
             Guid gID = Guid.Empty;
             try
             {
                 SqlProcs.spOPPORTUNITIES_New(ref gID, Sql.ToGuid(txtACCOUNT_ID.Value), txtNAME.Text, Sql.ToDecimal(txtAMOUNT.Text), C10n.ID, T10n.ToServerTime(ctlDATE_CLOSED.Value), lstSALES_STAGE.SelectedValue);
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                 lblError.Text = ex.Message;
             }
             if (!Sql.IsEmptyGuid(gID))
             {
                 Response.Redirect("~/Opportunities/view.aspx?ID=" + gID.ToString());
             }
         }
     }
 }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "NewRecord")
     {
         reqNAME.Enabled = true;
         reqNAME.Validate();
         if (Page.IsValid)
         {
             Guid gID = Guid.Empty;
             try
             {
                 SqlProcs.spTERMINOLOGY_InsertOnly(txtNAME.Text, lstLANGUAGE.SelectedValue, lstMODULE_NAME.SelectedValue, lstLIST_NAME.SelectedValue, Sql.ToInteger(txtLIST_ORDER.Text), txtDISPLAY_NAME.Text);
                 // 01/16/2006 Paul.  Update language cache.
                 if (Sql.IsEmptyString(lstLIST_NAME.SelectedValue))
                 {
                     L10N.SetTerm(lstLANGUAGE.SelectedValue, lstMODULE_NAME.SelectedValue, txtNAME.Text, txtDISPLAY_NAME.Text);
                 }
                 else
                 {
                     L10N.SetTerm(lstLANGUAGE.SelectedValue, lstMODULE_NAME.SelectedValue, lstLIST_NAME.SelectedValue, txtNAME.Text, txtDISPLAY_NAME.Text);
                 }
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                 lblError.Text = ex.Message;
             }
             if (!Sql.IsEmptyGuid(gID))
             {
                 Response.Redirect("default.aspx");
             }
         }
     }
 }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "NewRecord")
     {
         reqLAST_NAME.Enabled = true;
         //reqPHONE_WORK.Enabled = true;  // 07/16/2005 Paul.  Phone is not currently validated.
         reqEMAIL1.Enabled = true;
         reqLAST_NAME.Validate();
         reqPHONE_WORK.Validate();
         reqEMAIL1.Validate();
         if (Page.IsValid)
         {
             Guid gID = Guid.Empty;
             try
             {
                 SqlProcs.spLEADS_New(ref gID, txtFIRST_NAME.Text, txtLAST_NAME.Text, txtPHONE_WORK.Text, txtEMAIL1.Text);
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                 lblError.Text = ex.Message;
             }
             if (!Sql.IsEmptyGuid(gID))
             {
                 Response.Redirect("~/Leads/view.aspx?ID=" + gID.ToString());
             }
         }
         else
         {
             reqEMAIL1.ErrorMessage = L10n.Term("Contacts.LBL_INVALID_EMAIL") + " " + txtEMAIL1.Text + "<br>";
         }
     }
 }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "NewRecord")
     {
         reqNAME.Enabled       = true;
         reqACCOUNT_ID.Enabled = true;
         reqNAME.Validate();
         reqACCOUNT_ID.Validate();
         if (Page.IsValid)
         {
             Guid gID = Guid.Empty;
             try
             {
                 SqlProcs.spQUOTES_New(ref gID, Sql.ToGuid(txtACCOUNT_ID.Value), txtNAME.Text, lstQUOTE_STAGE.SelectedValue);
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                 lblError.Text = ex.Message;
             }
             if (!Sql.IsEmptyGuid(gID))
             {
                 Response.Redirect("~/Quotes/view.aspx?ID=" + gID.ToString());
             }
         }
     }
 }
Example #20
0
 /// <summary>
 /// Calls the validate method on the embedded required validator if permitted
 /// </summary>
 public void Validate()
 {
     if (Required && requiredValidator != null)
     {
         requiredValidator.Validate();
     }
 }
Example #21
0
        protected void  dtgZonasTarifario_Update(Object sender, DataGridCommandEventArgs e)
        {
            string importe = "";

            importe = ((TextBox)e.Item.FindControl("txtKgExcTari")).Text;
            BaseValidator          valImporteExcTar = (RegularExpressionValidator)((PlaceHolder)e.Item.FindControl("phValidKgExcTari")).FindControl("valImporteExcTar");
            RequiredFieldValidator reqImporteExcTar = (RequiredFieldValidator)((PlaceHolder)e.Item.FindControl("phValidKgExcTari")).FindControl("reqImporteExcTar");

            valImporteExcTar.Enabled = true;
            reqImporteExcTar.Enabled = true;
            valImporteExcTar.Validate();
            reqImporteExcTar.Validate();
            if (!valImporteExcTar.IsValid || !reqImporteExcTar.IsValid)
            {
                return;
            }
            int key = Convert.ToInt32(dtgZonasTarifario.DataKeys[(int)e.Item.ItemIndex]);
            ITarifarioFleteZona oTariZona = tariFlete.ZonasCol.GetTarifarioFleteZonaByFleteZonaID(key);

            oTariZona.ImporteKgExcedente = Convert.ToDouble(importe);
            // Asignamos el usuario que está efectuando la acción.
            IUsuarios usuarioConectato = UsuariosFactory.GetUsuario();

            usuarioConectato.Login = this.usuarioConectadoID;
            usuarioConectato.ConsultarByLogin();

            oTariZona.Guardar(usuarioConectato.UsuarioID);
            dtgZonasTarifario.EditItemIndex = -1;
            this.BindGridZonasTarif(0);
            this.SetearPorTarifarioReferencia();

            this.chkZonasTarifTodas.Checked = false;
        }
Example #22
0
        public void ShouldReturnTrueForValueType()
        {
            int       testValue = 1;
            Validator requiredFieldValidator = new RequiredFieldValidator(testValue);

            Assert.IsTrue(requiredFieldValidator.Validate());
        }
        private void dtgDocumentosCobrados_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            if (((TextBox)e.Item.FindControl("txtImporte")).Text == "0")
            {
                ((TextBox)e.Item.FindControl("txtImporte")).Text = "";
            }

            RequiredFieldValidator req = (RequiredFieldValidator)((PlaceHolder)e.Item.FindControl("phValidImporte")).FindControl("ReqImporte");

            req.Enabled = true;
            req.Validate();
            if (!req.IsValid)
            {
                return;
            }

            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            this.dsDocumentosCA = (DsDocumentosCobradosAgencias)Session["dsDocumentos"];
            DsDocumentosCobradosAgencias.DatosRow dr = (DsDocumentosCobradosAgencias.DatosRow) this.dsDocumentosCA.Datos.Rows[e.Item.DataSetIndex];

            IDocumentoCobradoAgencia dca = DocumentoCobradoAgenciaFactory.GetDocumentoCobradoAgencia();

            dca.DocumentoCobradoAgenciaID = dr.DocumentoCobradoAgenciaID;
            dca.AgenciaID     = dr.AgenciaID;
            dca.DocumentoNro  = dr.DocumentoNro;
            dca.Importe       = dr.Importe;
            dca.Observaciones = dr.IsObservacionesNull() ? null : dr.Observaciones;

            try
            {
                dca.Guardar();
                this.dtgDocumentosCobrados.EditItemIndex = -1;
                Session["dsDocumentos"] = null;
                this.BindGrilla();
            }
            catch (Exception ex)
            {
                string mensaje = ex.Message;
                try
                {
                    mensaje = this.TraducirTexto(ex.Message);
                    if (mensaje == "" || mensaje == null)
                    {
                        mensaje = ex.Message;
                    }
                }
                catch (Exception)
                {
                    mensaje = ex.Message;
                }
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(mensaje);
            }
        }
Example #24
0
        public void ValidateSingleFieldByAttribute()
        {
            Asset asset = new Asset(AssetType(DefectTypeName));
            IAttributeDefinition defectNameDef = asset.AssetType.GetAttributeDefinition(TitleAttributeName);

            Assert.IsFalse(validator.Validate(asset, defectNameDef));

            asset.LoadAttributeValue(defectNameDef, "Valid defect name");
            Assert.IsTrue(validator.Validate(asset, defectNameDef));
        }
Example #25
0
        public override bool RequiredFieldsValidator(FrameWork.DataBusinessModel.DataModel.Persistent persistentObject, FrameWork.DataBusinessModel.ErrorMessages messages)
        {
            bool result = base.RequiredFieldsValidator(persistentObject, messages);

            if (persistentObject is Destinaciones)
            {
                Destinaciones          destinacion = persistentObject as Destinaciones;
                RequiredFieldValidator validator   = new RequiredFieldValidator(messages);
                if (!validator.Validate(destinacion.Codigo, "Debe ingresar un código"))
                {
                    result = false;
                }
                if (!validator.Validate(destinacion.Descripcion, "Debe ingresar una descripción"))
                {
                    result = false;
                }
            }
            return(result);
        }
        private void dtgConvenio_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                PlaceHolder phDescripcion = (PlaceHolder)e.Item.FindControl("phDescripcion");
                phDescripcion.Controls.Add(GenerarValidadores.Requerido("txtDescripcion", "Debe ingresar la descripción, es obligatorio", false, "descripReq"));
                PlaceHolder phPrecio = (PlaceHolder)e.Item.FindControl("phPrecio");
                phPrecio.Controls.Add(GenerarValidadores.Requerido("txtPrecio", "Debe ingresar el precio, es obligatorio", false, "precioReq"));
                phPrecio.Controls.Add(GenerarValidadores.DecimalPositivo("txtPrecio", "El precio debe ser un decimal positivo", false, "precioValid"));

                RequiredFieldValidator rqDescripcion = (RequiredFieldValidator)((PlaceHolder)e.Item.FindControl("phDescripcion")).FindControl("descripReq");
                rqDescripcion.Enabled = true;
                rqDescripcion.Validate();
                if (!rqDescripcion.IsValid)
                {
                    return;
                }
                RequiredFieldValidator rqPrecio = (RequiredFieldValidator)((PlaceHolder)e.Item.FindControl("phPrecio")).FindControl("precioReq");
                rqPrecio.Enabled = true;
                rqPrecio.Validate();
                if (!rqPrecio.IsValid)
                {
                    return;
                }
                BaseValidator bvPrecio = (BaseValidator)((PlaceHolder)e.Item.FindControl("phPrecio")).FindControl("precioValid");
                bvPrecio.Enabled = true;
                bvPrecio.Validate();
                if (!bvPrecio.IsValid)
                {
                    return;
                }
                DsConvenioMensualEmpresaTerceros ds       = (DsConvenioMensualEmpresaTerceros)Session["DataSet"];
                IConvenioMensualEmpresaTerceros  convenio = ConvenioMensualEmpresaTercerosFactory.GetConvenioMensualFactory();
                if (ds.Datos.Count > 0)
                {
                    DsConvenioMensualEmpresaTerceros.DatosRow dr = (DsConvenioMensualEmpresaTerceros.DatosRow)ds.Datos.Rows[e.Item.ItemIndex];
                    convenio.ConvenioID        = dr.ConvenioID;
                    convenio.Descripcion       = ((TextBox)e.Item.FindControl("txtDescripcion")).Text;
                    convenio.Precio            = Utiles.Validaciones.obtieneDouble(((TextBox)e.Item.FindControl("txtPrecio")).Text);
                    convenio.EmpresaTercerosID = dr.EmpresaTercerosID;
                    convenio.Guardar();
                    Session["DataSet"] = null;
                }
            }
            catch (Exception ex)
            {
                ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message);
            }
            finally
            {
                dtgConvenio.EditItemIndex = -1;
                BindGrid();
            }
        }
Example #27
0
 public void Validate()
 {
     reqDATE.Enabled = true;
     valDATE.Enabled = true;
     // 04/15/2006 Paul.  The error message is not binding properly.  Just assign here as a quick solution.
     // 06/09/2006 Paul.  Now that we have solved the data binding issues, we can let the binding fill the message.
     //valDATE.ErrorMessage = L10n.Term(".ERR_INVALID_DATE");
     reqDATE.Validate();
     // 08/31/2006 Paul.  Enable and perform date validation.
     valDATE.Validate();
 }
Example #28
0
    //登入驗證前
    protected void UserLogin_LoggingIn(object sender, LoginCancelEventArgs e)
    {
        RequiredFieldValidator RV1 = (RequiredFieldValidator)UserLogin.FindControl("RV1");

        RV1.Enabled = true;
        RV1.Validate();
        RequiredFieldValidator RV2 = (RequiredFieldValidator)UserLogin.FindControl("RV2");

        RV2.Enabled = true;
        RV2.Validate();
    }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "Save")
     {
         NAME.Text             = NAME.Text.Trim();
         NAME_REQUIRED.Enabled = true;
         NAME_REQUIRED.Validate();
         if (Page.IsValid)
         {
             try
             {
                 CRON_MINUTES.Text    = CRON_MINUTES.Text.Trim();
                 CRON_HOURS.Text      = CRON_HOURS.Text.Trim();
                 CRON_DAYOFMONTH.Text = CRON_DAYOFMONTH.Text.Trim();
                 CRON_MONTHS.Text     = CRON_MONTHS.Text.Trim();
                 CRON_DAYOFWEEK.Text  = CRON_DAYOFWEEK.Text.Trim();
                 if (Sql.IsEmptyString(CRON_MINUTES.Text))
                 {
                     CRON_MINUTES.Text = "*";
                 }
                 if (Sql.IsEmptyString(CRON_HOURS.Text))
                 {
                     CRON_HOURS.Text = "*";
                 }
                 if (Sql.IsEmptyString(CRON_DAYOFMONTH.Text))
                 {
                     CRON_DAYOFMONTH.Text = "*";
                 }
                 if (Sql.IsEmptyString(CRON_MONTHS.Text))
                 {
                     CRON_MONTHS.Text = "*";
                 }
                 if (Sql.IsEmptyString(CRON_DAYOFWEEK.Text))
                 {
                     CRON_DAYOFWEEK.Text = "*";
                 }
                 string sJOB_INTERVAL = CRON_MINUTES.Text + "::" + CRON_HOURS.Text + "::" + CRON_DAYOFMONTH.Text + "::" + CRON_MONTHS.Text + "::" + CRON_DAYOFWEEK.Text;
                 SqlProcs.spSCHEDULERS_Update(ref gID, NAME.Text, JOB.SelectedValue, DATE_TIME_START.Value, DATE_TIME_END.Value, sJOB_INTERVAL, TIME_FROM.Value, TIME_TO.Value, STATUS.SelectedValue, CATCH_UP.Checked);
             }
             catch (Exception ex)
             {
                 ctlEditButtons.ErrorText = ex.Message;
                 return;
             }
             Response.Redirect("view.aspx?ID=" + gID.ToString());
         }
     }
     else if (e.CommandName == "Cancel")
     {
         Response.Redirect("default.aspx");
     }
 }
        public bool Validar(bool validarControlInterno)
        {
            if (validarControlInterno)
            {
                RequiredFieldValidator     valRequeridoCalle   = (RequiredFieldValidator)this.phValidCalle.FindControl("valRequeridoCalle");
                RegularExpressionValidator valDescripcionCalle = (RegularExpressionValidator)this.phValidCalle.FindControl("valDescripcionCalle");
                RegularExpressionValidator valEnteroNroCalle   = (RegularExpressionValidator)this.phValidCalleNro.FindControl("valEnteroNroCalle");
                //RequiredFieldValidator valRequeridoTelefono = (RequiredFieldValidator)this.phValidTelefono.FindControl("valRequeridoTelefono");
                //RequiredFieldValidator valRequeridoProvincia = (RequiredFieldValidator)this.phValidCalle.FindControl("valRequeridoProvincia");
                //RequiredFieldValidator valRequeridoLocalidad = (RequiredFieldValidator)this.phValidCalle.FindControl("valRequeridoLocalidad");
                CustomValidator cstmValidatorProvincia = (CustomValidator)phValidProvincia.FindControl("cstmValidatorProvincia");
                CustomValidator cstmValidatorLocalidad = (CustomValidator)phValidLocalidad.FindControl("cstmValidatorLocalidad");

                valRequeridoCalle.Enabled   = true;
                valDescripcionCalle.Enabled = true;
                valEnteroNroCalle.Enabled   = true;
                //valRequeridoTelefono.Enabled = true;
                cstmValidatorProvincia.Enabled = true;
                cstmValidatorLocalidad.Enabled = true;
                valRequeridoCalle.Validate();
                valDescripcionCalle.Validate();
                valEnteroNroCalle.Validate();
                //valRequeridoTelefono.Validate();
                cstmValidatorProvincia.Validate();
                cstmValidatorLocalidad.Validate();
                if (valRequeridoCalle.IsValid && valDescripcionCalle.IsValid && valEnteroNroCalle.IsValid && cstmValidatorProvincia.IsValid && cstmValidatorLocalidad.IsValid)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                RequiredFieldValidator     valRequeridoCalle   = (RequiredFieldValidator)this.phValidCalle.FindControl("valRequeridoCalle");
                RegularExpressionValidator valDescripcionCalle = (RegularExpressionValidator)this.phValidCalle.FindControl("valDescripcionCalle");
                RegularExpressionValidator valEnteroNroCalle   = (RegularExpressionValidator)this.phValidCalleNro.FindControl("valEnteroNroCalle");
                //RequiredFieldValidator valRequeridoTelefono = (RequiredFieldValidator)this.phValidTelefono.FindControl("valRequeridoTelefono");
                RequiredFieldValidator valRequeridoProvincia = (RequiredFieldValidator)this.phValidCalle.FindControl("valRequeridoProvincia");
                RequiredFieldValidator valRequeridoLocalidad = (RequiredFieldValidator)this.phValidCalle.FindControl("valRequeridoLocalidad");
                valRequeridoCalle.Enabled   = false;
                valDescripcionCalle.Enabled = false;
                valEnteroNroCalle.Enabled   = false;
                //valRequeridoTelefono.Enabled = true;
                valRequeridoProvincia.Enabled = false;
                valRequeridoLocalidad.Enabled = false;
                return(true);
            }
        }