using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Text;
/// <summary>
/// TOPdo 的摘要说明
/// </summary>
public class TOPdo
{
	public TOPdo()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}

    public static bool  Execsql(string sqlstr)
    {
        try
        {
            SqlConnection conn = CDatabase.wtoconn();
            conn.Open();
            SqlCommand cmd = new SqlCommand(sqlstr, conn);
            cmd.ExecuteNonQuery();
            conn.Close();
            return true;
        }
        catch
        {
            return false;
        }

    }


    public static bool ExecW(int userid,int pid,string Catt)
    {
        SqlConnection connW=CDatabase .wtoconn();
        connW.Open();
        SqlCommand smd = new SqlCommand("select count(*) from cart where userid=" + userid + " and pid=" + pid + " and Attribute='"+Catt+"'", connW);
        int count =Convert.ToInt32(smd.ExecuteScalar());
        if (count > 0)
        {
            return true;
        }
        else
        {
            return false;
        }
        connW.Close();
    }
    //检查会员唯一性
    public static bool chkadminuser(string username)
    {
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand scd = new SqlCommand("select count(*) from MemberVIP where vipusername='" +username+ "'", conn);
        int count = Convert.ToInt32(scd.ExecuteScalar());
        if (count > 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    //发送邮件

    //验证用户名和密码
    public static bool checkUser(string UserName, string PassWord)
    {
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand scd = new SqlCommand("select count(*) from MemberVIP where vipusername='" + UserName + "' and vipuserpwd='" + PassWord + "' and isok='y'", conn);
        int count = Convert.ToInt32(scd.ExecuteScalar());
        if (count > 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}
