using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;

public partial class etw_f_m_untranslist : System.Web.UI.Page
{
    public string language = string.Empty;
    public string username = string.Empty;
    public string domain = string.Empty;
    public int untranssum = 0;
    public int translatesum = 0;
    public int langid = 0;
    public int id = 0;
    public int chatid = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie GetCookie = Request.Cookies["cook_admin"];
        if (Request.Cookies["cook_admin"] == null)
        {
            Response.Redirect("../etw_c_m/index.aspx");
        }

        if (!IsPostBack)
        {
            etwadmin();
            translatesum = (int)DbHelperSQL.GetSingle("select count(id) from etw_translate where achivetime!=0 and (language ='" + domain + "' or target ='" + domain + "' )");
            transplate();
        }

    }
    public void etwadmin()
    {
        DataSet ds = DbHelperSQL.Query("select * from etw_admin where etwadminname='" + Request.Cookies["cook_admin"]["username"] + "'");
        if (ds.Tables[0].Rows.Count > 0)
        {
            username = ds.Tables[0].Rows[0]["realname"].ToString();
            langid = Convert.ToInt32(ds.Tables[0].Rows[0]["transid"].ToString());
        }

        etw.etw_language lag = new etw.etw_language();
        lag.id = langid;
        lag.GetModel();
        language = lag.language;
        domain = lag.domain;
    }
    public void transplate()
    {
        DataSet ds1 = DbHelperSQL.Query("select etw_translate.priority,case etw_translate.type when '1' then '询盘' when '2' then '回复' else '' end as type,etw_translate.receivetime,etw_user.company,etw_translate.language,etw_translate.chatid,etw_translate.id from etw_translate  inner join etw_user  on etw_translate.userid=etw_user.userid where achivetime=0 and (language ='" + domain + "' or target ='" + domain + "' )");
        untranssum = ds1.Tables[0].Rows.Count;
        if (ds1.Tables[0].Rows.Count > 0)
        {
            Repeater1.DataSource = ds1.Tables[0].DefaultView;
            Repeater1.DataBind();
        }

    }

    public string time(string timeStamp)
    {
        DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
        long lTime = long.Parse(timeStamp + "0000000");
        TimeSpan toNow = new TimeSpan(lTime);
        DateTime dtResult = dtStart.Add(toNow);
        return dtResult.ToString("yy-MM-dd HH:mm");
    }
    public string pristr(string n, string m)
    {
        string str = string.Empty;
        if (n == "1")
        {
            str = "<span  style=\"color:#F00\"> 优先</span>";
        }
        else
        {
            str = m;
        }
        return str;
    }
    
}
