예제 #1
0
        public void Commit(sy_VariablesDataset DataGenericas, sy_VariablesUsuariosDataset DataUsuarios, sy_VariablesPerfilesDataset DataPerfiles, sy_VariablesPuestosDataset DataPuestos)
        {
            switch (TipoVariable)
            {
            case "GENERICA":
            {
                sy_VariablesDataset.sy_VariablesRow rowG;
                if (Estado.Equals("NEW"))
                {
                    rowG                    = DataGenericas.sy_Variables.Newsy_VariablesRow();
                    rowG.IdVariable         = IdVariable;
                    rowG.Descripcion        = Descripcion;
                    rowG.ValorDefault       = Valor;
                    rowG.IdTipoVariable     = IdTipoVariable;
                    rowG.Categoria          = Categoria;
                    rowG.Comentario         = Comentario;
                    rowG.FechaCreacion      = DateTime.Now;
                    rowG.IdConexionCreacion = Security.IdConexion;
                    DataGenericas.sy_Variables.Addsy_VariablesRow(rowG);
                }
                else if (Estado.Equals("MODIF"))
                {
                    rowG                = mz.erp.businessrules.sy_Variables.GetByPk(IdVariableOriginal);
                    rowG.IdVariable     = IdVariable;
                    rowG.Descripcion    = Descripcion;
                    rowG.ValorDefault   = Valor;
                    rowG.IdTipoVariable = IdTipoVariable;
                    rowG.Categoria      = Categoria;
                    rowG.Comentario     = Comentario;
                    DataGenericas.sy_Variables.ImportRow(rowG);
                }
                else                         //Es borrado
                {
                    rowG = mz.erp.businessrules.sy_Variables.GetByPk(IdVariableOriginal);
                    rowG.Delete();
                    DataGenericas.sy_Variables.ImportRow(rowG);
                }
                break;
            }

            case "USUARIO":
            {
                sy_VariablesUsuariosDataset.sy_VariablesUsuariosRow rowU;
                if (Estado.Equals("NEW"))
                {
                    rowU                    = DataUsuarios.sy_VariablesUsuarios.Newsy_VariablesUsuariosRow();
                    rowU.IdVariable         = IdVariable;
                    rowU.IdUsuario          = IdUsuario;
                    rowU.Valor              = Valor;
                    rowU.FechaCreacion      = DateTime.Now;
                    rowU.IdConexionCreacion = Security.IdConexion;
                    DataUsuarios.sy_VariablesUsuarios.Addsy_VariablesUsuariosRow(rowU);
                }
                else if (Estado.Equals("MODIF"))
                {
                    rowU            = mz.erp.businessrules.sy_VariablesUsuarios.GetByPk(IdVariableOriginal, IdUsuario);
                    rowU.IdVariable = IdVariable;
                    rowU.Valor      = Valor;
                    DataUsuarios.sy_VariablesUsuarios.ImportRow(rowU);
                }
                else                         //Es borrado
                {
                    rowU = mz.erp.businessrules.sy_VariablesUsuarios.GetByPk(IdVariableOriginal, IdUsuario);
                    rowU.Delete();
                    DataUsuarios.sy_VariablesUsuarios.ImportRow(rowU);
                }
                break;
            }

            case "PERFIL":
            {
                sy_VariablesPerfilesDataset.sy_VariablesPerfilesRow rowP;
                if (Estado.Equals("NEW"))
                {
                    rowP                    = DataPerfiles.sy_VariablesPerfiles.Newsy_VariablesPerfilesRow();
                    rowP.IdVariable         = IdVariable;
                    rowP.IdPerfil           = IdPerfil;
                    rowP.Valor              = Valor;
                    rowP.FechaCreacion      = DateTime.Now;
                    rowP.IdConexionCreacion = Security.IdConexion;
                    DataPerfiles.sy_VariablesPerfiles.Addsy_VariablesPerfilesRow(rowP);
                }
                else if (Estado.Equals("MODIF"))
                {
                    rowP            = mz.erp.businessrules.sy_VariablesPerfiles.GetByPk(IdVariableOriginal, IdPerfil);
                    rowP.IdVariable = IdVariable;
                    rowP.Valor      = Valor;
                    DataPerfiles.sy_VariablesPerfiles.ImportRow(rowP);
                }
                else                         //Es borrado
                {
                    rowP = mz.erp.businessrules.sy_VariablesPerfiles.GetByPk(IdVariableOriginal, IdPerfil);
                    rowP.Delete();
                    DataPerfiles.sy_VariablesPerfiles.ImportRow(rowP);
                }

                break;
            }

            case "PUESTO":
            {
                sy_VariablesPuestosDataset.sy_VariablesPuestosRow rowP;
                if (Estado.Equals("NEW"))
                {
                    rowP                    = DataPuestos.sy_VariablesPuestos.Newsy_VariablesPuestosRow();
                    rowP.IdVariable         = IdVariable;
                    rowP.IdPuesto           = IdPuesto;
                    rowP.IdEmpresa          = Security.IdEmpresa;
                    rowP.IdSucursal         = Security.IdSucursal;
                    rowP.Valor              = Valor;
                    rowP.FechaCreacion      = DateTime.Now;
                    rowP.IdConexionCreacion = Security.IdConexion;
                    DataPuestos.sy_VariablesPuestos.Addsy_VariablesPuestosRow(rowP);
                }
                else if (Estado.Equals("MODIF"))
                {
                    rowP            = mz.erp.businessrules.sy_VariablesPuestos.GetByPk(IdVariableOriginal, Security.IdEmpresa, Security.IdSucursal, IdPuesto);
                    rowP.IdVariable = IdVariable;
                    rowP.Valor      = Valor;
                    DataPuestos.sy_VariablesPuestos.ImportRow(rowP);
                }
                else                         //Es borrado
                {
                    rowP = mz.erp.businessrules.sy_VariablesPuestos.GetByPk(IdVariableOriginal, Security.IdEmpresa, Security.IdSucursal, IdPuesto);
                    rowP.Delete();
                    DataPuestos.sy_VariablesPuestos.ImportRow(rowP);
                }
                break;
            }
            }
        }
예제 #2
0
 public bool EsAlta()
 {
     return(Estado.Equals("ALTA"));
 }