/// <summary> /// Valida un sy_VariablesEmpresasRow. /// </summary> public static bool RowIsValid(sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); bool isValid = true; string mensaje; if (!IdVariableIsValid(row.IdVariable, out mensaje)) { row.SetColumnError("IdVariable", mensaje); isValid = false; } if (!IdEmpresaIsValid(row.IdEmpresa, out mensaje)) { row.SetColumnError("IdEmpresa", mensaje); isValid = false; } if (!ValorIsValid(row.Valor, out mensaje)) { row.SetColumnError("Valor", mensaje); isValid = false; } if (!FechaCreacionIsValid(row.FechaCreacion, out mensaje)) { row.SetColumnError("FechaCreacion", mensaje); isValid = false; } if (!IdConexionCreacionIsValid(row.IdConexionCreacion, out mensaje)) { row.SetColumnError("IdConexionCreacion", mensaje); isValid = false; } if (!UltimaModificacionIsValid(row.UltimaModificacion, out mensaje)) { row.SetColumnError("UltimaModificacion", mensaje); isValid = false; } if (!IdConexionUltimaModificacionIsValid(row.IdConexionUltimaModificacion, out mensaje)) { row.SetColumnError("IdConexionUltimaModificacion", mensaje); isValid = false; } if (!RowIdIsValid(row.RowId, out mensaje)) { row.SetColumnError("RowId", mensaje); isValid = false; } ; return(isValid); }
public static void Update(sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow row) { if (row.RowState == DataRowState.Detached) { ((sy_VariablesEmpresasDataset.sy_VariablesEmpresasDataTable)row.Table).Addsy_VariablesEmpresasRow(row); } Update(row.Table); }
public static void UpdateWithValidation(sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); if (RowIsValid(row)) { Update(row); } }
public static object GetValuePK(string IdVariable, long IdEmpresa) { sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow row = sy_VariablesEmpresas.GetByPk(IdVariable, IdEmpresa); if (row != null) { return(row.Valor); } else { return(null); } }
/// <summary> /// Obtiene un registro de la tabla sy_VariablesEmpresas que luego puede ser persistido en la base de datos. /// </summary> public static sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow GetByPk(string IdVariable, long IdEmpresa) { sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow row = mz.erp.dataaccess.sy_VariablesEmpresas.GetByPk(IdVariable, IdEmpresa); if (row != null) { foreach (DataColumn dc in row.Table.Columns) { if (!dc.Caption.ToUpper().Equals("ROWID")) { if (row[dc] == System.DBNull.Value) { row[dc] = Util.DefaultValue(dc.DataType); } } } } return(row); }
/// <summary> /// Envia los cambios del sy_VariablesEmpresasRow a la base de datos. /// </summary> public static void Update(sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); mz.erp.dataaccess.sy_VariablesEmpresas.Update(row); }
/// <summary> /// Establece los valores por defecto de sy_VariablesEmpresasRow. /// </summary> public static sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow SetRowDefaultValues(sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow row) { row.IdVariable = Util.NewStringId(); row.IdEmpresa = Security.IdEmpresa; row.Valor = string.Empty; row.FechaCreacion = mz.erp.businessrules.Sistema.DateTime.Now; row.IdConexionCreacion = Security.IdConexion; row.UltimaModificacion = null; row.IdConexionUltimaModificacion = Security.IdConexion; row.RowId = Guid.Empty; return(row); }
public void Commit() { foreach (ConfiguracionNueva cn in _configuracionesNuevas) { switch (cn.TipoHabilitado) { case "Usuario": { ArrayList keys = new ArrayList(); keys.Add(cn.IdVariable); keys.Add(cn.IdHabilitado); sy_VariablesUsuariosDataset.sy_VariablesUsuariosRow rowU1 = (sy_VariablesUsuariosDataset.sy_VariablesUsuariosRow)_dataUsuarios.sy_VariablesUsuarios.Rows.Find(keys.ToArray()); if (rowU1 == null) { sy_VariablesUsuariosDataset.sy_VariablesUsuariosRow rowU = mz.erp.businessrules.sy_VariablesUsuarios.GetByPk(cn.IdVariable, cn.IdHabilitado); if (rowU == null) { rowU = _dataUsuarios.sy_VariablesUsuarios.Newsy_VariablesUsuariosRow(); rowU.IdVariable = cn.IdVariable; rowU.IdUsuario = cn.IdHabilitado; rowU.Valor = "@" + cn.DescripcionDatoNuevo; rowU.FechaCreacion = DateTime.Now; rowU.IdConexionCreacion = Security.IdConexion; _dataUsuarios.sy_VariablesUsuarios.Addsy_VariablesUsuariosRow(rowU); } else { rowU.Valor = rowU.Valor + "@" + cn.DescripcionDatoNuevo; _dataUsuarios.sy_VariablesUsuarios.ImportRow(rowU); } } else { rowU1.Valor = rowU1.Valor + "@" + cn.DescripcionDatoNuevo; } break; } case "Perfil": { ArrayList keys = new ArrayList(); keys.Add(cn.IdVariable); keys.Add(cn.IdHabilitadoL); sy_VariablesPerfilesDataset.sy_VariablesPerfilesRow rowP1 = (sy_VariablesPerfilesDataset.sy_VariablesPerfilesRow)_dataPerfiles.sy_VariablesPerfiles.Rows.Find(keys.ToArray()); if (rowP1 == null) { sy_VariablesPerfilesDataset.sy_VariablesPerfilesRow rowP = mz.erp.businessrules.sy_VariablesPerfiles.GetByPk(cn.IdVariable, cn.IdHabilitadoL); if (rowP == null) { rowP = _dataPerfiles.sy_VariablesPerfiles.Newsy_VariablesPerfilesRow(); rowP.IdVariable = cn.IdVariable; rowP.IdPerfil = cn.IdHabilitadoL; rowP.Valor = "@" + cn.DescripcionDatoNuevo; rowP.FechaCreacion = DateTime.Now; rowP.IdConexionCreacion = Security.IdConexion; _dataPerfiles.sy_VariablesPerfiles.Addsy_VariablesPerfilesRow(rowP); } else { rowP.Valor = rowP.Valor + "@" + cn.DescripcionDatoNuevo; _dataPerfiles.sy_VariablesPerfiles.ImportRow(rowP); } } else { rowP1.Valor = rowP1.Valor + "@" + cn.DescripcionDatoNuevo; } break; } case "Puesto": { ArrayList keys = new ArrayList(); keys.Add(cn.IdVariable); keys.Add(Security.IdEmpresa); keys.Add(Security.IdSucursal); keys.Add(cn.IdHabilitadoL); sy_VariablesPuestosDataset.sy_VariablesPuestosRow rowP1 = (sy_VariablesPuestosDataset.sy_VariablesPuestosRow)_dataPuestos.sy_VariablesPuestos.Rows.Find(keys.ToArray()); if (rowP1 == null) { sy_VariablesPuestosDataset.sy_VariablesPuestosRow rowP = mz.erp.businessrules.sy_VariablesPuestos.GetByPk(cn.IdVariable, Security.IdEmpresa, Security.IdSucursal, cn.IdHabilitadoL); if (rowP == null) { rowP = _dataPuestos.sy_VariablesPuestos.Newsy_VariablesPuestosRow(); rowP.IdVariable = cn.IdVariable; rowP.IdPuesto = cn.IdHabilitadoL; rowP.IdEmpresa = Security.IdEmpresa; rowP.IdSucursal = Security.IdSucursal; rowP.Valor = "@" + cn.DescripcionDatoNuevo; rowP.FechaCreacion = DateTime.Now; rowP.IdConexionCreacion = Security.IdConexion; _dataPuestos.sy_VariablesPuestos.Addsy_VariablesPuestosRow(rowP); } else { rowP.Valor = rowP.Valor + "@" + cn.DescripcionDatoNuevo; _dataPuestos.sy_VariablesPuestos.ImportRow(rowP); } } else { rowP1.Valor = rowP1.Valor + "@" + cn.DescripcionDatoNuevo; } break; } case "Empresa": { ArrayList keys = new ArrayList(); keys.Add(cn.IdVariable); keys.Add(cn.IdHabilitadoL); sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow rowE1 = (sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow)_dataEmpresas.sy_VariablesEmpresas.Rows.Find(keys.ToArray()); if (rowE1 == null) { sy_VariablesEmpresasDataset.sy_VariablesEmpresasRow rowE = mz.erp.businessrules.sy_VariablesEmpresas.GetByPk(cn.IdVariable, cn.IdHabilitadoL); if (rowE == null) { rowE = _dataEmpresas.sy_VariablesEmpresas.Newsy_VariablesEmpresasRow(); rowE.IdVariable = cn.IdVariable; rowE.IdEmpresa = cn.IdHabilitadoL; rowE.Valor = "@" + cn.DescripcionDatoNuevo; rowE.FechaCreacion = DateTime.Now; rowE.IdConexionCreacion = Security.IdConexion; _dataEmpresas.sy_VariablesEmpresas.Addsy_VariablesEmpresasRow(rowE); } else { rowE.Valor = rowE.Valor + "@" + cn.DescripcionDatoNuevo; _dataEmpresas.sy_VariablesEmpresas.ImportRow(rowE); } } else { rowE1.Valor = rowE1.Valor + "@" + cn.DescripcionDatoNuevo; } break; } case "Sucursal": { ArrayList keys = new ArrayList(); keys.Add(cn.IdVariable); keys.Add(cn.IdHabilitadoLAux); keys.Add(cn.IdHabilitadoL); sy_VariablesSucursalesDataset.sy_VariablesSucursalesRow rowS1 = (sy_VariablesSucursalesDataset.sy_VariablesSucursalesRow)_dataSucursales.sy_VariablesSucursales.Rows.Find(keys.ToArray()); if (rowS1 == null) { sy_VariablesSucursalesDataset.sy_VariablesSucursalesRow rowS = mz.erp.businessrules.sy_VariablesSucursales.GetByPk(cn.IdVariable, cn.IdHabilitadoLAux, cn.IdHabilitadoL); if (rowS == null) { rowS = _dataSucursales.sy_VariablesSucursales.Newsy_VariablesSucursalesRow(); rowS.IdVariable = cn.IdVariable; rowS.IdEmpresa = cn.IdHabilitadoLAux; rowS.IdSucursal = cn.IdHabilitadoL; rowS.Valor = "@" + cn.DescripcionDatoNuevo; rowS.FechaCreacion = DateTime.Now; rowS.IdConecxionCreacion = Security.IdConexion; _dataSucursales.sy_VariablesSucursales.Addsy_VariablesSucursalesRow(rowS); } else { rowS.Valor = rowS.Valor + "@" + cn.DescripcionDatoNuevo; _dataSucursales.sy_VariablesSucursales.ImportRow(rowS); } } else { rowS1.Valor = rowS1.Valor + "@" + cn.DescripcionDatoNuevo; } break; } } } }