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

public partial class SYSadmin_Products_Integral : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["WtoRightName"] == null)
        {
            Response.Redirect("~/SYSADMIN/main/error.aspx?err=非法登陆!或系统超时，请刷新后重新登录");
        }
        if (!IsPostBack)
        {
            SqlConnection conn = CDatabase.wtoconn();
            conn.Open();
            SqlCommand smd;
            SqlDataReader sdr;
            smd = new SqlCommand("select * from Integral", conn);
            sdr = smd.ExecuteReader();
            sdr.Read();
            this.where1.Text = sdr["where1"].ToString();
            this.where2.Text = sdr["where2"].ToString();
            this.where3.Text = sdr["where3"].ToString();
            this.result1.Text = sdr["result1"].ToString();
            this.result2.Text = sdr["result2"].ToString();
            this.result3.Text = sdr["result3"].ToString();
            this.result4.Text = sdr["result4"].ToString();
            this.bbs.Text = sdr["bbsson"].ToString();
            sdr.Close();
            smd = new SqlCommand("select IntegralSet from SystemBasicInformation", conn);
            this.newreg.Text = Convert.ToString(smd.ExecuteScalar());
            conn.Close();
        }
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        string sql1 = "", sql2 = "" ;
        sql1 = "update Integral set Integralyz='100',where1='" + this.where1.Text + "',where2='" + this.where2.Text + "',where3='" + this.where3.Text + "',result1='" + this.result1.Text + "',result2='" + this.result2.Text + "',result3='" + this.result3.Text + "',result4='" + this.result4.Text + "',bbsson='" + this.bbs.Text + "'";
        sql2 = "update SystemBasicInformation set IntegralSet="+newreg.Text;
        if (Doadmin.Exec(sql1) && Doadmin.Exec(sql2))
        {
            Response.Write("<script>alert('提交成功');window.location.href='Integral.aspx'</script>");
        }
        else
        {
            Response.Write("<script>alert('此次操作失败');window.location.href='Integral.aspx'</script>");
        }
    }
}
