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_translate : 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 langid = 0;
    public int translatesum = 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();
            untranssum = (int)DbHelperSQL.GetSingle("select count(id) from etw_translate where achivetime=0 and trans_content is null and (language ='" + domain + "' or target ='" + domain + "' )");
            translatesum = (int)DbHelperSQL.GetSingle("select count(id) from etw_translate where achivetime!=0 and trans_content is not null and (language ='" + domain + "' or target ='" + domain + "' )");
        }
    }

    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;
    }

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Response.Cookies["cook_admin"].Expires = DateTime.Now.AddDays(-5);
        Response.Write("<script type=text/javascript>parent.location.reload();</script>");
    }
}
