public List <LoginClientDepartmentBE> ListaEmpresaUnidadULogin(int IdCompany, int IdClientDepartment, int IdLogin)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_LoginClientDepartment_ListaCompanyUnidadLogin");

            db.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, IdCompany);
            db.AddInParameter(dbCommand, "pIdClientDepartment", DbType.Int32, IdClientDepartment);
            db.AddInParameter(dbCommand, "pIdLogin", DbType.Int32, IdLogin);

            IDataReader reader = db.ExecuteReader(dbCommand);
            List <LoginClientDepartmentBE> LoginClientDepartmentlist = new List <LoginClientDepartmentBE>();
            LoginClientDepartmentBE        LoginClientDepartment;

            while (reader.Read())
            {
                LoginClientDepartment = new LoginClientDepartmentBE();
                LoginClientDepartment.IdLoginClientDepartment = Int32.Parse(reader["IdLoginClientDepartment"].ToString());
                LoginClientDepartment.IdCompany          = Int32.Parse(reader["IdCompany"].ToString());
                LoginClientDepartment.IdLogin            = Int32.Parse(reader["IdLogin"].ToString());
                LoginClientDepartment.IdClientDepartment = Int32.Parse(reader["IdClientDepartment"].ToString());
                LoginClientDepartment.FlagState          = Boolean.Parse(reader["FlagState"].ToString());
                LoginClientDepartment.TipoOper           = 4;
                LoginClientDepartmentlist.Add(LoginClientDepartment);
            }
            reader.Close();
            reader.Dispose();
            return(LoginClientDepartmentlist);
        }
Example #2
0
 public void Elimina(LoginClientDepartmentBE pItem)
 {
     try
     {
         LoginClientDepartmentDL LoginClientDepartment = new LoginClientDepartmentDL();
         LoginClientDepartment.Elimina(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
        public void Elimina(LoginClientDepartmentBE pItem)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_LoginClientDepartment_Elimina");

            db.AddInParameter(dbCommand, "pIdLoginClientDepartment", DbType.Int32, pItem.IdLoginClientDepartment);
            db.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, pItem.IdCompany);
            db.AddInParameter(dbCommand, "pLogin", DbType.String, pItem.Login);
            db.AddInParameter(dbCommand, "pMachine", DbType.String, pItem.Machine);


            db.ExecuteNonQuery(dbCommand);
        }
        void AgregarClientDepartment(string IdClient, string IdClientDepartment)
        {
            var Buscar = pListaLoginClientDepartment.Where(oB => oB.IdClient.ToString() == IdClient && oB.IdClientDepartment.ToString() == IdClientDepartment).ToList();

            if (Buscar.Count > 0)
            {
            }
            else
            {
                LoginClientDepartmentBE loginclientdepartment = null;
                loginclientdepartment = new LoginClientDepartmentBE();
                loginclientdepartment.IdLoginClientDepartment = 0;
                loginclientdepartment.IdCompany          = Convert.ToInt32(cboEmpresa.EditValue);
                loginclientdepartment.IdLogin            = IdLogin;
                loginclientdepartment.IdClientDepartment = Convert.ToInt32(IdClientDepartment);
                loginclientdepartment.FlagState          = true;
                loginclientdepartment.TipoOper           = Convert.ToInt32(Operacion.Nuevo);
                pListaLoginClientDepartment.Add(loginclientdepartment);
            }
        }
        public List <LoginClientDepartmentBE> ListaClient(int IdLogin)
        {
            Database  db        = DatabaseFactory.CreateDatabase("cnERPBD");
            DbCommand dbCommand = db.GetStoredProcCommand("usp_LoginClientDepartment_ListaClient");

            db.AddInParameter(dbCommand, "pIdLogin", DbType.Int32, IdLogin);

            IDataReader reader = db.ExecuteReader(dbCommand);
            List <LoginClientDepartmentBE> LoginClientDepartmentlist = new List <LoginClientDepartmentBE>();
            LoginClientDepartmentBE        LoginClientDepartment;

            while (reader.Read())
            {
                LoginClientDepartment            = new LoginClientDepartmentBE();
                LoginClientDepartment.IdClient   = Int32.Parse(reader["IdClient"].ToString());
                LoginClientDepartment.NameClient = reader["NameClient"].ToString();
                LoginClientDepartmentlist.Add(LoginClientDepartment);
            }
            reader.Close();
            reader.Dispose();
            return(LoginClientDepartmentlist);
        }
        void EliminarClientDepartment(string IdClient, string IdClientDepartment)
        {
            //Borrar en bloque
            LoginClientDepartmentBE Acceso = pListaLoginClientDepartment.Find(delegate(LoginClientDepartmentBE _Acc)
            {
                if (_Acc.IdClient.ToString() == IdClient && _Acc.IdClientDepartment.ToString() == IdClientDepartment)
                {
                    return(true);
                }
                return(false);
            });

            if (Acceso != null)
            {
                if (Acceso.TipoOper == Convert.ToInt32(Operacion.Nuevo))
                {
                    Acceso.TipoOper = Convert.ToInt32(Operacion.Consultar);
                }
                if (Acceso.TipoOper == Convert.ToInt32(Operacion.Modificar) || Acceso.TipoOper == Convert.ToInt32(Operacion.Consultar))
                {
                    Acceso.TipoOper = Convert.ToInt32(Operacion.Eliminar);
                }
            }
        }