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_c_m_productupddetails : System.Web.UI.Page
{
    public int lid = 0;
    public string company = string.Empty;
    public string url = string.Empty;
    public string content = string.Empty;
    public string edittime = string.Empty;
    public string web = string.Empty;
    public int userid = 0;
    public string wancheng = string.Empty;
    public string fujian = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        

        if (Request.QueryString["lid"].ToString() != null)
        {
            lid = Convert.ToInt32(Request.QueryString["lid"].ToString());
            if (!Page.IsPostBack)
            {
                etw.etw_productupd lead = new etw.etw_productupd();
                lead.id = lid;
                lead.GetModel();
                userid = lead.userid;
                content = lead.content;
                url = lead.url;
                edittime = lead.edittime;
                web = lead.web.ToString();
                if(lead.achivetime!=null && lead.achivetime!="")
                {
                    wancheng = lead.etwinfo + "<br /> <span style='color:#ff0000;font-weight:bold;'>完成时间:" + lead.achivetime + "</span>";
                    etwinfotxt.Visible = false;
                    Button1.Visible = false;
                }
                if (lead.fujian != null && lead.fujian != "")
                {
                    fujian = "<a href=\"download.aspx?fujian="+lead.fujian+"\"" + " target=\"_blank\"><img src=\"images/rar.jpg\" width=\"44\" height=\"36\" border=\"0\" /> 下载附件</a>";

                }
                if (web == "1")
                { Button3.Visible = true;
                   Button2.Visible = false; 
                }
                else
                {
                    Button3.Visible = false;
                    Button2.Visible = true; 
                }
                DataSet ds = DbHelperSQL.Query("select company from etw_user where userid=" + userid);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    company = ds.Tables[0].Rows[0]["company"].ToString();
                }
            }
        }
    }
    public string get_web(string web)
    {
        string zhuangtai;
        if (web == "0")
        {
            zhuangtai = "<span style='color:#ff0000;font-weight:bold;'>你还未给客户电话回复</span>";
        }
        else
        {
            zhuangtai = "<span style='font-weight:bold;'>你已经给客户回复过电话</span>";
        }
        return zhuangtai;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        etw.etw_productupd lead = new etw.etw_productupd();
        lead.id = lid;
        lead.etwinfo = Fun.Encode(etwinfotxt.Text.Trim());
        lead.phreply = 1;
        lead.achivetime = Fun.GetDateTime();
        lead.Update_etwinfo();
        Fun.JsAlerT("此信息已经处理完成", "productupd.aspx");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        etw.etw_productupd lead = new etw.etw_productupd();
        lead.id = lid;
        lead.web = 1;
        lead.Update_web();
        Fun.JsAlerT("更新成功", "productupddetails.aspx?lid=" + lid);
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        etw.etw_productupd lead = new etw.etw_productupd();
        lead.id = lid;
        lead.web = 0;
        lead.Update_web();
        Fun.JsAlerT("更新成功", "productupddetails.aspx?lid=" + lid);
    }
}
