using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
//
using HaiTianTechEDWebReference;
using System.Data;
using System.Data.SqlClient;

public partial class verifyinfo : System.Web.UI.Page
{
    public string flowtype = "";
    public string tishi = "";
    DataHelpService db = new DataHelpService();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Type("type") == "1")
        {
            flowtype = "1";
            Bind(1);
        }
        else
        {
            flowtype = "0";
            tishi = "(点击审核)";
            Bind(0);
        }
        if (Type("qid") != "")
        {
            db.UpdateCustomerQuestion(Type("qid").ToString());
            flowtype = "1";
            tishi = "";
            Bind(1);
        }
    }

    public void Bind(int i)
    {
        DataSet ds = db.GetCustomerQuestion(i);
        this.rp_bind.DataSource = ds;
        this.rp_bind.DataBind();

    }
    protected void bt_verify_Click(object sender, EventArgs e)
    {
        string id = Getid("qid");
        if (id != string.Empty)
        {
            id = id.Replace("'", "");
            id = "'" + id.Replace(",", "','") + "'";
            db.UpdateCustomerQuestion(id);
            //Response.Write(id+"<br>");
            //int i = 0;
            //foreach (char ch in id)
            //{
            //    if (ch == ',')
            //    {
            //        i += 1;
            //    }
            //}
            //i += 1;
            //Response.Write(i+"<br>");
            //int startindex = 0;
            //for (int ii = 0; ii < i; ii++)
            //{
            //    int index = id.IndexOf(',', startindex);
            //    if (index == -1)
            //    {
            //        index = id.Length;
            //    }
            //    string qid = id.Substring(startindex+1, index - startindex-2);
            //    db.UpdateCustomerQuestion(qid);
            //    startindex = index + 1;
            //}
        }
    }
    //获得question的id号
    public  string Getid(string id)
    {
        string value = HttpContext.Current.Request.Form[id];
        return value == null ? string.Empty : value.Trim();
    }
    //是否审核
    public string Verify(string verfy,string right,string wrong)
    {
        return (verfy == "1") ?"<font style='color:red;'>"+  right+"</font>" : wrong;
    }
    //类型
    public string Type( string type)
    {
        string value = HttpContext.Current.Request.QueryString[type];
		return value == null ? string.Empty : value.Trim();

    }
  
}