protected void Submit_Click(object sender, EventArgs e)
        {
            LabMS.BLL.TeachingReform Reform = new LabMS.BLL.TeachingReform();
            LabMS.Model.TeachingReform ReformItem = new LabMS.Model.TeachingReform();
            ReformItem.Teach_Address = tb_Addres.Text;
            ReformItem.Teach_InCharge = tb_InCharge.Text;
            ReformItem.Teach_Mail = tb_Email.Text;
            ReformItem.Teach_ProjectName = tb_ProjectName.Text;

            ReformItem.Teach_UnitName = tb_UnitName.Text;
            ReformItem.Teach_UnitType = rbl_UnitType.SelectedValue;

            ReformItem.Teach_Phone = tb_Phone.Text;
            ReformItem.Teach_Time = DateTime.Now;

            ReformItem.Teach_DocType = ddl_ProjectType.SelectedValue.Trim();

            string savePath = HttpContext.Current.Request.MapPath(@"../Content/UpLoadFile/");
            string Append = DateTime.Now.ToString("yyyyMMddhhmmss");
            string FullPathFileName = savePath.Trim() + Append.Trim()+"_" + fp_Attach.FileName.Trim();
            int attachID = 0;
            bool save = true;
            if (fp_Attach.HasFile)
            {
                try
                {

                    fp_Attach.SaveAs(FullPathFileName);

                }
                catch
                {
                    save = false;
                    throw new Exception("File Save Error");
                }
            }
            if (save)
            {
                LabMS.BLL.Attachment Attach = new LabMS.BLL.Attachment();
                LabMS.Model.Attachment attach = new LabMS.Model.Attachment();
                attach.Attach_Name = fp_Attach.FileName;
                attach.Attach_Address = FullPathFileName;
                attachID = Attach.Add(attach);

            }
            if(attachID!=0)
            {
                ReformItem.Teach_Attachment=attachID;
            }
            Reform.Add(ReformItem);

            Response.Redirect(@"\ProjectApp\TeachingReformList.aspx");
        }
        protected void DataBinds()
        {
            LabMS.BLL.TeachingReform Reform = new LabMS.BLL.TeachingReform();
            LabMS.Model.TeachingReform model = Reform.GetModel(Convert.ToInt32( QueryString));

            LabMS.BLL.DictionaryClass DicClass = new LabMS.BLL.DictionaryClass();
            LabMS.BLL.Dictionary Dic = new LabMS.BLL.Dictionary();
            LabMS.Model.DictionaryClass ds = new LabMS.Model.DictionaryClass();
            List<LabMS.Model.Dictionary> ls = new List<LabMS.Model.Dictionary>();

            if (DicClass.GetModelList("Code='TeachingReform'").Count != 0)
            {
                ds = DicClass.GetModelList("Code='TeachingReform'")[0];
                ls = Dic.GetModelList("DClass='" + ds.Code + "'");
                if (ls.Count != 0)
                {
                    ddl_ProjectType.DataSource = ls;
                    ddl_ProjectType.DataTextField = "Name";
                    ddl_ProjectType.DataValueField = "Code";
                    ddl_ProjectType.DataBind();
                    if (!string.IsNullOrEmpty(model.Teach_DocType))
                    {
                        ddl_ProjectType.Items.FindByValue(model.Teach_DocType).Selected = true;
                    }
                }
            }

            tb_Addres.Text = model.Teach_Address;
            tb_Email.Text = model.Teach_Mail;
            tb_InCharge.Text = model.Teach_InCharge;
            tb_Phone.Text = model.Teach_Phone;
            tb_UnitName.Text = model.Teach_UnitName;
            tb_ProjectName.Text = model.Teach_ProjectName;

            if (DicClass.GetModelList("Code='UnitType'").Count > 0)
            {
                ds = DicClass.GetModelList("Code='UnitType'")[0];
                ls = Dic.GetModelList("DClass='" + ds.Code + "'");
                if (ls.Count > 0)
                {
                    rbl_UnitType.DataSource = ls;
                    rbl_UnitType.DataTextField = "Name";
                    rbl_UnitType.DataValueField = "Code";
                    rbl_UnitType.DataBind();
                    if (!string.IsNullOrEmpty(model.Teach_UnitType))
                    {
                        rbl_UnitType.Items.FindByValue(model.Teach_UnitType).Selected = true;
                    }
                }
            }
        }
        protected void Submit_Click(object sender, EventArgs e)
        {
            LabMS.BLL.TeachingReform Reform = new LabMS.BLL.TeachingReform();
            LabMS.Model.TeachingReform model = new LabMS.Model.TeachingReform();
            model = Reform.GetModel(Convert.ToInt32(QueryString));

            model.Teach_ProjectName = tb_ProjectName.Text;
            model.Teach_Address = tb_Addres.Text;
            model.Teach_InCharge = tb_InCharge.Text;
            model.Teach_Mail = tb_Email.Text;
            model.Teach_ProjectName = tb_ProjectName.Text;
            model.Teach_UnitName = tb_UnitName.Text;
            model.Teach_UnitType = rbl_UnitType.SelectedValue;
            model.Teach_Phone = tb_Phone.Text;
            model.Teach_Time = DateTime.Now;
            model.Teach_DocType = ddl_ProjectType.SelectedValue.Trim();

            Reform.Update(model);
            Response.Redirect(@"\ProjectApp\TeachingReformList.aspx");
        }