using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using System.Data.OleDb;

public partial class BackCenter_Instru_InstruEdit : System.Web.UI.Page
{
    public DataRow dr;
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 过期和权限

        PageFunc.IfLogin(this.Page);

        #endregion
        //if (IsPostBack)
        //    return;
        if (Request["iid"] != null && Request["iid"].ToString() != "")
        {
            string sql = "select i.Type,i.Number,i.StartTime,i.EndTime,i.AddTime,i.Mark,i.Person,i.Teacher,i.Audit,m.Account,m.Name,d.Title from NT_Instru i,NT_Member m,NT_Data d where i.MemberId=m.ID and i.DataId=d.ID and i.ID=" + Request["iid"].ToString();
            dr = DbHelperOleDb.ExecuteDataSet(CommandType.Text, sql, null).Tables[0].Rows[0];
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Request["iid"] != null && Request["iid"] != "")
        {
            #region 操作数据库


            StringBuilder strSql = new StringBuilder();
            strSql.Append("update NT_Instru set ");
            strSql.Append("Audit=@Audit,");
            strSql.Append("Mark2=@Mark2");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters = {
					new OleDbParameter("@Audit", OleDbType.Integer,4),
                    new OleDbParameter("@Mark2", OleDbType.VarChar),
					new OleDbParameter("@ID", OleDbType.Integer,4)};
            parameters[0].Value = int.Parse(ddl_Audit.SelectedValue);
            parameters[1].Value = txt_Mark2.Text.Trim();
            parameters[2].Value = Request["iid"];
            //执行语句
            DbHelperOleDb.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters);


            #endregion

            JavaScriptFunc.AlertAndRedirect(this.Page, "审核完成", "InstruIndex.aspx");
        }
    }
}
