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 JuSNS.Model;
using JuSNS.UI.Control;

namespace JuSNS.Web.system.sys
{
    public partial class VoAdd : JuSNS.UI.Page.ManagePage
    {
        protected string sort = "sys";
        JuSNS.Home.Space sp = new JuSNS.Home.Space();
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    this.txtFlag.Value = Request.QueryString["Flag"];
                    if (this.txtFlag.Value == "1")
                    {
                        this.txtID.Value = Request.QueryString["ID"];
                        this.txtVocationName.Value = Request.QueryString["Name"];
                    }
                    else
                    {
                        this.txtID.Value = "0";
                        this.txtVocationName.Value = "";
                    }
                }
            }
            catch { }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int n = sp.UpdateAddVocation(int.Parse(this.txtID.Value), this.txtVocationName.Value, int.Parse(this.txtFlag.Value));
            if (n == 1)
            {
                this.txtID.Value = "";
                Response.Redirect("vo.aspx");
            }
            else if (n == 2)
            {
                PageError("操作失败,该行业名称已经存在!", "vo.aspx");
            }
            else
            {
                PageError("操作失败!", "vo.aspx");
            }
        }
    }
}
