⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 companyuser.java

📁 软件上传下载网站,上传用户经过注册成为本站会员就可将将软件上传到本网站
💻 JAVA
字号:
package downreg;
import java.sql.*;
public class companyUser
{
   int C_Id=0;
   String C_Name="";
   String C_Password="";
   String C_PwdQuestion="";
   String C_PwdKey="";
   String C_Homepage="";
   String C_Email="";
   int C_Post=0;
   String C_Address ="";
   String C_Telephone="";
   String C_Type="";
   String C_Account="";
   String C_RegTime="0000-00-00 00:00:00";
   String C_RegIpAddress="";
   String C_CheckResult="";

   Connection con = null;
   Statement stmt = null;
   ResultSet rs = null;
   String tableName="corp_user";
   public  companyUser()
   {
      String url="";
      String driverName="com.mysql.jdbc.Driver";
      String userName="root";
      String userPasswd="324802";
      String dbName="downreg";
      try
        {
          Class.forName(driverName).newInstance();
          url="jdbc:mysql://localhost/"+dbName+"?user="+userName+"&password="+userPasswd+"&useUnicode=true&characterEncoding=gb2312";
          con= DriverManager.getConnection(url);
          stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
        }
      catch (Exception e)
        {
        }
   }

   public void setC_Id(int id)
   {
     C_Id=id;
   }
   public void setC_Name(String name)
   {
     C_Name=name;
   }
   public void setC_Password(String password)
   {
     C_Password=password;
   }

   public void setC_PwdQuestion(String pwdQuestion)
   {
    C_PwdQuestion=pwdQuestion;
   }
   public void setC_PwdKey(String pwdKey)
   {
    C_PwdKey=pwdKey;
   }


   public void setC_Homepage(String homepage)
   {
   C_Homepage=homepage;
   }
   public void setC_Email(String email)
    {
    C_Email=email;
    }
   public void setC_Post(int post)
    {
     C_Post=post;
    }
   public void setC_Address(String address)
   {
   C_Address=address;
   }
   public void setC_Telephone(String telephone)
   {
   C_Telephone=telephone;
   }
   public void setC_Type(String type)
   {
   C_Type=type;
   }
   public void setC_Account(String account)
   {
   C_Account=account;
   }
   public void setC_RegTime(String regTime)
   {
   C_RegTime=regTime;
   }
   public void setC_RegIpAddress(String ip)
   {
    C_RegIpAddress=ip;
   }
   public void setC_CheckResult(String checkResult)
   {
   C_CheckResult=checkResult;
   }



    public int getC_Id()
   {
     return C_Id;
   }
   public String getC_Name()
   {
     return C_Name;
   }
   public String getC_Password()
   {
    return C_Password;
   }

   public String getC_PwdQuestion()
   {
    return C_PwdQuestion;
   }
   public String getC_PwdKey()
   {
    return C_PwdKey;
   }

   public String getC_Homepage()
   {
    return C_Homepage;
   }
   public String getC_Email()
    {
    return C_Email;
    }
   public int getC_Post()
    {
     return C_Post;
    }
   public String getC_Address()
   {
   return C_Address;
   }
   public String getC_Telephone()
   {
   return C_Telephone;
   }
   public String getC_Type()
   {
   return C_Type;
   }
   public String getC_Account()
   {
   return C_Account;
   }
   public String  getC_RegTime()
   {
   return C_RegTime;
   }
   public String getC_RegIpAddress()
   {
    return C_RegIpAddress;
   }

   public String getC_CheckResult()
   {
   return C_CheckResult;
   }

public ResultSet executeQuery(String sql)
{
rs=null;
try{
rs=stmt.executeQuery(sql);
}
catch(SQLException e){
System.err.println(e.getMessage());
}
return rs;
}

public boolean Check(String name)  //审核企业用户
{
try
{
String condition="update "+tableName+" set C_CheckResult=1 where C_Name='"+name+"'";
stmt.executeUpdate(condition);
}
catch(Exception e)
{
}
return true;
}

 public ResultSet LookUpPassUsers()//查看可以上传软件的企业用户
{
 String s="通过";
try
{

String condition="select * from "+tableName+" where C_CheckResult="+"'"+s+"'";
rs=stmt.executeQuery(condition);

}
catch(Exception e)
{
}
return rs;
}
public ResultSet LookDLoadUsers() //查看只能下载的企业用户
{
 String s="未通过";
try
{

String condition="select * from "+tableName+" where C_CheckResult="+"'"+s+"'";
rs=stmt.executeQuery(condition);

}
catch(Exception e)
{
}
return rs;
}





public boolean deleteSingle(String name)//删除单个企业用户
{
try
{

 String condition="delete from "+tableName+" where C_Name='"+name+"'" ;
 stmt.executeUpdate(condition);

}
catch(Exception e)
{
}
return true;
}

public boolean setVIP(String name)  //set VIP 用户
{
  String s="VIP用户";
  try{

     String condition="update "+tableName+" set C_Type='"+s+"' where C_Name='"+name+"'";
     stmt.executeUpdate(condition);
      }
  catch(Exception e)
  {
  return false;
  }
  return true;
}

public boolean freeze(String name)  //冻结用户
{
  int s1=0;
  try{

     String condition="update "+tableName+" set C_State='"+s1+"' where C_Name='"+name+"'";
     stmt.executeUpdate(condition);
      }
  catch(Exception e)
  {
  return false;
  }
  return true;
}

public boolean charge(String name,float m)  //给用户冲值
{
   float b,c;
   String a="",d="";
  try{
     String s="select * from "+tableName+" where C_Name='"+name+"'";
     rs=stmt.executeQuery(s);
     if(rs.next())
     {
      d=rs.getString("C_Account");
      c=Float.parseFloat(d);
      b=c+m;
      a=String.valueOf(b);
      String condition="update "+tableName+" set C_Account='"+a+"' where C_Name='"+name+"'";
      stmt.executeUpdate(condition);
      return true;
     }
     else
     {return false;}
    }
  catch(Exception e)
  {
  //return false;
  System.out.println(""+e);
  }
   return true;
}

public boolean active(String name)  //解冻用户
{
  int s2=1;
  try{

     String condition="update "+tableName+" set C_State='"+s2+"' where C_Name='"+name+"'";
     stmt.executeUpdate(condition);
      }
  catch(Exception e)
  {
  return false;
  }
return true;
}


public void close()
{
try
{
if(rs!=null)
{
  rs.close();
}
if(stmt!=null)
{
  stmt.close();
}
if(con!=null)
{
  con.close();
}
}
catch (SQLException e)
{
}
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -