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;

/// <summary>
/// CDatabase 的摘要说明
/// </summary>
namespace Task
{
public class FUNC
{

    public FUNC()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}
    public string filepath = @"~/upfile/task/";//图片文件目录
    public string[] LAY = new string[10];

    public void SetLAY()
    {
       LAY[1]= "秀才";
       LAY[2] = "举人";
       LAY[3]="进士";
       LAY[4] = "探花";
       LAY[5] = "榜眼";
       LAY[6] = "状元";
       
    }

    public string SurplusDateTime(string sdt, string edt)
    {
        
        DateTime t1 = Convert.ToDateTime(sdt);
        DateTime t2 = Convert.ToDateTime(edt);
        if (t1.CompareTo(t2) > 0)
        {
            return "-";
        }
        else
        {
            WEB.FUNC ddf = new WEB.FUNC();
            return ddf.DateDiff(Convert.ToDateTime(edt), Convert.ToDateTime(sdt));
        }
    }

    public void TaskViewCallNum(string id)
    {
        CDatabase.DBUpdate("update taksinfo set callnum=callnum+1 where id=" + id);

    }
    public void MemberIntegral(string id,int i)
    {
        CDatabase.DBUpdate("update MemberVIP set Integral=Integral+"+i+" where id=" + id.ToString());
        int integral=0;
        integral = Convert.ToUInt16(CDatabase.DBReadData("select integral from membervip where id=" + id.ToString()));
        integral = integral / 50;
        CDatabase.DBUpdate("update MemberVIP set vipright="+integral+" where id=" + id.ToString());

    }
    public static string viptype(int type)
    {
        string title="";
        switch (type)
        { 
            case 1:
                title= "(秀才)";
                break;
            case 2:
                title= "(举人)";
                break;
            case 3:
                title= "(进士)";
                break;
            case 4:
                title= "(探花)";
                break;
            case 5:
                title= "(榜眼)";
                break;
            case 6:
                title= "(状元)";
                break;
        }
        return title;
    }

}
}
