Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //根据当前模板状态显示部件
                Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"];

                OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);
                conn.Open();

                //显示模板的当前编辑部分
                //Page.Form.Controls[3].FindControl(tempInfo.Anchor).Visible = true;
                Dal.Models.Template_01_PublicBuilding tempPublicBuilding =
                    BLL.Declaration.GetDeclarationData <Dal.Models.Template_01_PublicBuilding>(tempInfo.DeclarationID.Value, conn);
                Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn);

                //SetDropDownList(DesignCategory, BLL.SysConstant.GetConstantList("14", conn));
                //SetDropDownList(InvestSource, BLL.SysConstant.GetConstantList("15", conn));
                //SetDropDownList(DeclarationLevel, BLL.SysConstant.GetConstantList("04", conn));

                //List<Dal.Models.SysConstant> lstDomesticOrAbord = BLL.SysConstant.GetConstantList("19", conn);
                //SetDropDownList(DomesticOrAbord1, lstDomesticOrAbord);
                //SetDropDownList(DomesticOrAbord2, lstDomesticOrAbord);
                //SetDropDownList(DomesticOrAbord3, lstDomesticOrAbord);
                //SetDropDownList(DomesticOrAbord4, lstDomesticOrAbord);

                //List<Dal.Models.SysConstant> lstCollaborativePhase = BLL.SysConstant.GetConstantList("20", conn);
                //SetDropDownList(CollaborativePhase1, lstCollaborativePhase);
                //CollaborativePhase1.Items.Insert(0, new ListItem(""));
                //SetDropDownList(CollaborativePhase2, lstCollaborativePhase);
                //CollaborativePhase2.Items.Insert(0, new ListItem(""));
                //SetDropDownList(CollaborativePhase3, lstCollaborativePhase);
                //CollaborativePhase3.Items.Insert(0, new ListItem(""));
                //SetDropDownList(CollaborativePhase4, lstCollaborativePhase);
                //CollaborativePhase4.Items.Insert(0, new ListItem(""));

                //为控件赋值
                BLL.Common.SetData <Dal.Models.Template_01_PublicBuilding>(tempPublicBuilding, Page);

                // 设置参与人员
                //ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn);

                Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn);
                //DeclarationName.Text = decl.DeclarationName;
                DeclarationUnit.Text = org.OrganizationName;
                //PostalAddress.Text = org.OrganizationAddress;
                //Linkman.Text = org.Linkman;
                //TelephoneNumber.Text = org.TelephoneNumber;
                //FaxNumber.Text = org.FaxNumber;
                //MobileNumber.Text = org.MobileNumber;
                //Postcode.Text = org.Postcode;
                //EmailAddress.Text = Request.QueryString["id"];//org.EmailAddress

                conn.Close();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"];

                OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);
                conn.Open();

                Dal.Models.Declaration decl  = BLL.Declaration.GetDeclaration(Convert.ToInt32(tempInfo.DeclarationID), conn);
                Dal.Models.Prize       Prize = BLL.Prize.GetPrize(Convert.ToInt32(decl.PrizeID), conn);
                rdlPrize.Text = Prize.PrizeName;

                conn.Close();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Dal.Models.TemplateInfo tempInfo = null;
     try
     {
         tempInfo = ((Declaration)Context.Handler).TempInfo;
     }
     catch
     {
         Response.Redirect("../Mutual/UserEntry.aspx");
     }
     if (tempInfo == null)
     {
         Response.Redirect("../Mutual/UserEntry.aspx");
     }
     txtDeclarationID.Text = tempInfo.DeclarationID.ToString();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Dal.Models.TemplateInfo tempInfo = ((Declaration)Context.Handler).TempInfo;
            Dal.Models.TemplateInfo tempInfo = null;
            try
            {
                tempInfo = ((Declaration)Context.Handler).TempInfo;
            }
            catch
            {
                Response.Redirect("../Mutual/UserEntry.aspx");
            }
            if (tempInfo == null)
            {
                Response.Redirect("../Mutual/UserEntry.aspx");
            }

            txtDeclarationID.Text = tempInfo.DeclarationID.ToString();
            OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);

            conn.Open();
            // Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"];
            // Dal.Models.TemplateInfo tempInfo = ((Declaration)Context.Handler).TempInfo;

            DataTable dtData = BLL.Declaration.GetDeclarationData(tempInfo.DeclarationID.Value, conn);

            DataRow[] rows = dtData.Select("RecordType='RichText'");

            System.Web.UI.Control ctrl = null;
            foreach (DataRow row in rows)
            {
                if (this.FindControl(row["RecordNameEn"].ToString()) != null)
                {
                    ctrl = this.FindControl(row["RecordNameEn"].ToString());
                    ((System.Web.UI.WebControls.Label)ctrl).Text =
                        row["Data"] == null || row["Data"] == DBNull.Value ? "" : row["Data"].ToString();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ActivityType"] == null || Session["UserInfo"] == null)
            {
                Response.Redirect("../Mutual/UserEntry.aspx");
                return;
            }
            if (!IsPostBack)
            {
                //根据当前模板状态显示部件
                //Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"];
                Dal.Models.TemplateInfo tempInfo = null;
                try
                {
                    tempInfo = ((Declaration)Context.Handler).TempInfo;
                }
                catch
                {
                    Response.Redirect("../Mutual/UserEntry.aspx");
                }
                if (tempInfo == null)
                {
                    Response.Redirect("../Mutual/UserEntry.aspx");
                }

                OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);

                conn.Open();

                //显示模板的当前编辑部分
                //divfather.FindControl(tempInfo.Anchor).Visible = true;
                Dal.Models.Template_10_CivilAirDefence tempCivilAirDefence =
                    BLL.Declaration.GetDeclarationData <Dal.Models.Template_10_CivilAirDefence>(tempInfo.DeclarationID.Value, conn);
                Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn);

                SetDropDownList(DesignCategory, BLL.SysConstant.GetConstantList("14", conn));
                SetDropDownList(InvestSource, BLL.SysConstant.GetConstantList("15", conn));
                SetDropDownList(ProfessionalCategories, BLL.SysConstant.GetConstantList("28", conn));
                //SetDropDownList(DeclarationLevel, BLL.SysConstant.GetConstantList("04", conn));

                List <Dal.Models.SysConstant> lstDomesticOrAbord = BLL.SysConstant.GetConstantList("19", conn);
                SetDropDownList(DomesticOrAbord1, lstDomesticOrAbord);
                SetDropDownList(DomesticOrAbord2, lstDomesticOrAbord);
                SetDropDownList(DomesticOrAbord3, lstDomesticOrAbord);
                SetDropDownList(DomesticOrAbord4, lstDomesticOrAbord);

                List <Dal.Models.SysConstant> lstCollaborativePhase = BLL.SysConstant.GetConstantList("20", conn);
                SetDropDownList(CollaborativePhase01, lstCollaborativePhase);
                CollaborativePhase01.Items.Insert(0, new ListItem(""));
                SetDropDownList(CollaborativePhase02, lstCollaborativePhase);
                CollaborativePhase02.Items.Insert(0, new ListItem(""));
                SetDropDownList(CollaborativePhase03, lstCollaborativePhase);
                CollaborativePhase03.Items.Insert(0, new ListItem(""));
                SetDropDownList(CollaborativePhase04, lstCollaborativePhase);
                CollaborativePhase04.Items.Insert(0, new ListItem(""));

                //为控件赋值
                BLL.Common.SetData <Dal.Models.Template_10_CivilAirDefence>(tempCivilAirDefence, divfather);

                // 设置参与人员
                ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn);

                Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn);

                DeclarationName.Text  = decl.DeclarationName;
                DeclarationUnit.Text  = org.OrganizationName;
                PostalAddress.Text    = org.OrganizationAddress;
                Linkman.Text          = org.Linkman;
                TelephoneNumber.Text  = org.TelephoneNumber;
                FaxNumber.Text        = org.FaxNumber;
                MobileNumber.Text     = org.MobileNumber;
                Postcode.Text         = org.Postcode;
                EmailAddress.Text     = org.EmailAddress;;//org.EmailAddress
                txtDeclarationID.Text = decl.DeclarationID.ToString();
                txtTemplate.Text      = tempInfo.TemplateCode;

                ucLegalStates.Org  = org;
                ucLegalStates.Decl = decl;
                ucCertificate.Org  = org;
                ucCertificate.Decl = decl;
                ucParticipant.Org  = org;
                ucParticipant.Decl = decl;
                ucComments.Org     = org;
                ucComments.Decl    = decl;
                //接受登录人员
                Dal.Models.UserInfo userInfo = (Dal.Models.UserInfo)Session["UserInfo"];
                txtUser.Text = userInfo.UserType;

                //接受场景
                if (!string.IsNullOrEmpty(tempInfo.Situation.ToString()))
                {
                    txtSituation.Text = tempInfo.Situation.ToString();
                }

                if (tempInfo.Situation.ToString() == "Declara")
                {
                    string strActivityType = Session["ActivityType"].ToString();

                    // 获取指定活动类型的当前激活活动
                    Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn);
                    if (actActivated == null)
                    {
                        conn.Close();
                        Response.Redirect("../Mutual/UserEntry.aspx");
                        return;
                    }

                    int    iActivity                = actActivated.ActivityID.Value;
                    string strSpecialty             = decl.DeclarationCode.Substring(4, 6);
                    Dal.Models.Specialty dSpecialty = BLL.Specialty.GetSpecialtyByCode(strSpecialty, iActivity, conn);
                    conn.Close();
                    nav02.InnerText = dSpecialty.SpecialtyName;
                }
            }
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ActivityType"] == null || Session["UserInfo"] == null)
            {
                Response.Redirect("../Mutual/UserEntry.aspx");
                return;
            }
            if (!IsPostBack)
            {
                //根据当前模板状态显示部件
                // Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"];
                Dal.Models.TemplateInfo tempInfo = null;
                try
                {
                    tempInfo = ((Declaration)Context.Handler).TempInfo;
                }
                catch
                {
                    Response.Redirect("../Mutual/UserEntry.aspx");
                }
                if (tempInfo == null)
                {
                    Response.Redirect("../Mutual/UserEntry.aspx");
                }

                OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);
                conn.Open();

                //显示模板的当前编辑部分
                //divfather.FindControl(tempInfo.Anchor).Visible = true;
                Dal.Models.Template_17_Standard tempStandard =
                    BLL.Declaration.GetDeclarationData <Dal.Models.Template_17_Standard>(tempInfo.DeclarationID.Value, conn);
                Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn);


                ListItem item = new ListItem();
                item.Text  = "行业";
                item.Value = "2401";
                ListItem item2 = new ListItem();
                item2.Text  = "地方";
                item2.Value = "2402";
                ListItem item3 = new ListItem();
                item3.Text  = "国家";
                item3.Value = "2403";
                ListItem item4 = new ListItem();
                item4.Text  = "其他";
                item4.Value = "2404";
                ProjectSource.Items.Add(item);
                ProjectSource.Items.Add(item2);
                ProjectSource.Items.Add(item3);
                ProjectSource.Items.Add(item4);
                //为控件赋值
                BLL.Common.SetData <Dal.Models.Template_17_Standard>(tempStandard, divfather);
                if (FileCatalog.Text == "")
                {
                    FileCatalog.Text = BLL.SysConstant.GetTemplateConstant(tempInfo.TemplateCode, "FileCatalogDefaultText", conn);
                }
                // 设置参与人员
                ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn);

                Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn);

                StandardName.Text     = decl.DeclarationName;
                ChiefEditorUnit.Text  = org.OrganizationName;
                PostalAddress.Text    = org.OrganizationAddress;
                Linkman.Text          = org.Linkman;
                TelephoneNumber.Text  = org.TelephoneNumber;
                FaxNumber.Text        = org.FaxNumber;
                MobileNumber.Text     = org.MobileNumber;
                Postcode.Text         = org.Postcode;
                EmailAddress.Text     = org.EmailAddress;;//org.EmailAddress
                txtDeclarationID.Text = decl.DeclarationID.ToString();
                txtTemplate.Text      = tempInfo.TemplateCode;

                ucLegalStates.Org  = org;
                ucLegalStates.Decl = decl;
                ucCertificate.Org  = org;
                ucCertificate.Decl = decl;
                ucParticipant.Org  = org;
                ucParticipant.Decl = decl;
                ucComments.Org     = org;
                ucComments.Decl    = decl;
                //接受登录人员
                Dal.Models.UserInfo userInfo = (Dal.Models.UserInfo)Session["UserInfo"];
                txtUser.Text = userInfo.UserType;

                //接受场景
                if (!string.IsNullOrEmpty(tempInfo.Situation.ToString()))
                {
                    txtSituation.Text = tempInfo.Situation.ToString();
                }

                if (tempInfo.Situation.ToString() == "Declara")
                {
                    string strActivityType = Session["ActivityType"].ToString();

                    // 获取指定活动类型的当前激活活动
                    Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn);
                    if (actActivated == null)
                    {
                        conn.Close();
                        Response.Redirect("../Mutual/UserEntry.aspx");
                        return;
                    }

                    int    iActivity                = actActivated.ActivityID.Value;
                    string strSpecialty             = decl.DeclarationCode.Substring(4, 6);
                    Dal.Models.Specialty dSpecialty = BLL.Specialty.GetSpecialtyByCode(strSpecialty, iActivity, conn);
                    conn.Close();
                    nav02.InnerText = dSpecialty.SpecialtyName;
                }

                //string sourceText = ProjectSource.SelectedItem.Text;
                //ProjectSource.Text = sourceText;
            }
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ActivityType"] == null || Session["UserInfo"] == null)
            {
                Response.Redirect("../Common/Login.aspx");
                return;
            }
            if (!IsPostBack)
            {
                //根据当前模板状态显示部件
                //Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"];
                Dal.Models.TemplateInfo tempInfo = null;
                try
                {
                    tempInfo = ((Declaration)Context.Handler).TempInfo;
                }
                catch
                {
                    Response.Redirect("../Mutual/UserEntry.aspx");
                }
                if (tempInfo == null)
                {
                    Response.Redirect("../Mutual/UserEntry.aspx");
                }

                OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);
                conn.Open();

                //显示模板的当前编辑部分 Template_18_WaterSystem
                //divfather.FindControl(tempInfo.Anchor).Visible = true;
                Dal.Models.Template_18_WaterSystem tempTraditionalBuilding =
                    BLL.Declaration.GetDeclarationData <Dal.Models.Template_18_WaterSystem>(tempInfo.DeclarationID.Value, conn);
                Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn);

                SetDropDownList(DeclarationCategory, BLL.SysConstant.GetConstantList("33", conn));

                //为控件赋值
                BLL.Common.SetData <Dal.Models.Template_18_WaterSystem>(tempTraditionalBuilding, divfather);

                // 设置参与人员
                ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn);

                Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn);

                DeclarationName.Text             = decl.DeclarationName;
                UseDeclarationName.Text          = decl.DeclarationName;
                ConstructionDeclarationName.Text = decl.DeclarationName;

                DeclarationUnit.Text  = org.OrganizationName;
                PostalAddress.Text    = org.OrganizationAddress;
                Linkman.Text          = org.Linkman;
                TelephoneNumber.Text  = org.TelephoneNumber;
                FaxNumber.Text        = org.FaxNumber;
                MobileNumber.Text     = org.MobileNumber;
                Postcode.Text         = org.Postcode;
                EmailAddress.Text     = org.EmailAddress;;//org.EmailAddress
                txtDeclarationID.Text = decl.DeclarationID.ToString();
                txtTemplate.Text      = tempInfo.TemplateCode;

                ucLegalStates.Org  = org;
                ucLegalStates.Decl = decl;
                ucCertificate.Org  = org;
                ucCertificate.Decl = decl;
                ucParticipant.Org  = org;
                ucParticipant.Decl = decl;
                ucComments.Org     = org;
                ucComments.Decl    = decl;
                //接受登录人员
                Dal.Models.UserInfo userInfo = (Dal.Models.UserInfo)Session["UserInfo"];
                txtUser.Text = userInfo.UserType;

                //接受场景
                if (!string.IsNullOrEmpty(tempInfo.Situation.ToString()))
                {
                    txtSituation.Text = tempInfo.Situation.ToString();
                }

                if (tempInfo.Situation.ToString() == "Declara")
                {
                    string strActivityType = Session["ActivityType"].ToString();

                    // 获取指定活动类型的当前激活活动
                    Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn);
                    if (actActivated == null)
                    {
                        conn.Close();
                        Response.Redirect("../Common/Login.aspx");
                        return;
                    }

                    int    iActivity                = actActivated.ActivityID.Value;
                    string strSpecialty             = decl.DeclarationCode.Substring(4, 6);
                    Dal.Models.Specialty dSpecialty = BLL.Specialty.GetSpecialtyByCode(strSpecialty, iActivity, conn);
                    conn.Close();
                    nav02.InnerText = dSpecialty.SpecialtyName;
                }
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);
                conn.Open();
                Dal.Models.UserInfo     UserInfo = (Dal.Models.UserInfo)Session["UserInfo"];
                Dal.Models.Activity     act      = (Dal.Models.Activity)Session["Activity"];
                Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"];
                Dal.Models.Declaration  decl     = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn);

                txtGrade.Text      = "Close";
                DeclarationID.Text = tempInfo.DeclarationID.ToString();
                if (UserInfo.UserType == "0805" && decl.ExpertReviewGroupID != null && decl.ExpertReviewer != 0)
                {
                    // 获取专家ID
                    Dal.Models.Expert expert = BLL.Expert.GetExpertByUserID(UserInfo.UserID.Value, conn);
                    if (expert.ExpertID == decl.ExpertReviewer)
                    {
                        txtGrade.Text        = "Open";
                        txtReviewWriter.Text = expert.ExpertName;
                        FirstComment.Text    = decl.ExpertReviewComment;

                        //    HtmlTableRow tr = new HtmlTableRow();
                        //    HtmlTableCell td1 = new HtmlTableCell("td");
                        //    td1.InnerHtml = "<p>评审意见填写人:" + expert.ExpertName + "</p>"
                        //        + "<textarea  ID='ExpertReviewComment' class='CommentsDis'  rows='3' cols='20' style='height:300px;width:90%;' data='Review'>"
                        //        + decl.ExpertReviewComment + "</textarea>";
                        //    td1.ColSpan = 4;
                        //    td1.Style.Add("border-bottom", "none");
                        //    td1.Style.Add("text-align", "center");
                        //    tr.Cells.Add(td1);

                        //    HtmlTableRow tr2 = new HtmlTableRow();
                        //    HtmlTableCell td2 = new HtmlTableCell("td");
                        //    HtmlTableCell td3 = new HtmlTableCell("td");
                        //    HtmlTableCell td4 = new HtmlTableCell("td");
                        //    HtmlTableCell td5 = new HtmlTableCell("td");
                        //    td2.InnerHtml = "组长(签名):";
                        //    td2.Style.Add("width", "40%");
                        //    td2.Style.Add("border-top", "none");
                        //    td2.Style.Add("border-right", "none");

                        //    td3.InnerHtml = "";
                        //    td3.Style.Add("width", "10%");
                        //    td3.Style.Add("border-top", "none");
                        //    td3.Style.Add("border-right", "none");
                        //    td3.Style.Add("border-left", "none");

                        //    td4.InnerHtml = "评审日期:";
                        //    td4.Style.Add("width", "40%");
                        //    td4.Style.Add("border-top", "none");
                        //    td4.Style.Add("border-right", "none");
                        //    td4.Style.Add("border-left", "none");

                        //    td5.InnerHtml = "";
                        //    td5.Style.Add("width", "10%");
                        //    td5.Style.Add("border-top", "none");
                        //    td5.Style.Add("border-left", "none");
                        //    tr2.Cells.Add(td2);
                        //    tr2.Cells.Add(td3);
                        //    tr2.Cells.Add(td4);
                        //    tr2.Cells.Add(td5);

                        //    tbReview.Rows.Add(tr);
                        //    tbReview.Rows.Add(tr2);
                    }
                }

                conn.Close();
            }
        }
        protected void btnNext_Click(object sender, EventArgs e)
        {
            Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"];

            // 创建申报项目
            Dal.Models.Declaration decl = null;
            bool   bChanged             = false;
            string strTemplateCode      = "";

            DateTime dtm;

            if (!DateTime.TryParse(txtDeclarateDate.Text, out dtm))
            {
                hdMsg.Value = "项目申报时间格式错误!";
                return;
            }


            int iPrizeID = Convert.ToInt32(Request["rdlPrize"]);

            if (iPrizeID == 0 && rdlPrize.SelectedValue != "")
            {
                iPrizeID = Convert.ToInt32(rdlPrize.SelectedValue);
            }

            if (iPrizeID == 0)
            {
                hdMsg.Value = "请选择奖项!";
                return;
            }

            OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);

            conn.Open();
            string strActivityType = Request.Cookies["ActivityType"].Value;

            Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn);
            string strDeclarationCode        = "";

            if (ViewState["DeclarationID"] != null)
            {
                decl = BLL.Declaration.GetDeclaration(Convert.ToInt32(ViewState["DeclarationID"]), conn);
                strDeclarationCode = decl.DeclarationCode;
            }
            else
            {
                decl            = new Dal.Models.Declaration();
                decl.UserID     = user.UserID;
                decl.ActivityID = actActivated.ActivityID;
            }

            if (decl.DeclareDate == null || decl.DeclareDate.Value != dtm)
            {
                bChanged         = true;
                decl.DeclareDate = dtm;
            }

            if (string.IsNullOrEmpty(decl.RecommendFrom) || decl.RecommendFrom != ChooseAssociation.SelectedValue)
            {
                bChanged           = true;
                decl.RecommendFrom = ChooseAssociation.SelectedValue;
            }

            if (decl.PrizeID == null || decl.PrizeID != iPrizeID)
            {
                bChanged     = true;
                decl.PrizeID = iPrizeID;
            }

            if (string.IsNullOrEmpty(decl.DeclarationName) || decl.DeclarationName != txtProjectName.Text.Trim())
            {
                bChanged             = true;
                decl.DeclarationName = txtProjectName.Text.Trim();
            }

            Dal.Models.Prize prize = BLL.Prize.GetPrize(decl.PrizeID.Value, conn);
            strTemplateCode = prize.TemplateCode;
            int iSpecilID = prize.SpecialtyID.Value;
            int actID     = prize.ActivityID.Value;

            Dal.Models.Schedule dSchedule = BLL.Schedule.GetSpecialtySchedule(iSpecilID, conn);

            if (dSchedule == null || !dSchedule.IsDeclarationStart.Value)
            {
                hdMsg.Value = "未在专业申报时间内,不能创建!";
                conn.Close();
                return;
            }

            string strSituation = "";

            if (!string.IsNullOrEmpty(Request["Situation"]))
            {
                strSituation = Request["Situation"].Replace("'", "").Replace("\"", "");
            }

            if (bChanged == true && (strSituation == Dal.Models.EnumSituation.Declaration.ToString() || strSituation == ""))
            {
                OleDbTransaction trans = conn.BeginTransaction();
                try
                {
                    BLL.Declaration.Declarate(ref decl, conn, trans);

                    string strImportDeclarationID = ImportDeclarationData.SelectedValue;
                    if (strImportDeclarationID != "0" && strImportDeclarationID != "")
                    {
                        string strDeclarationCode2 = BLL.Declaration.GetDeclaration(Convert.ToInt32(strImportDeclarationID), conn, trans).DeclarationCode;
                        BLL.Declaration.ImportDeclarate(decl.DeclarationID.Value, Convert.ToInt32(strImportDeclarationID), conn, trans);
                        BLL.Declaration.ImportUploadFile(decl.DeclarationID.Value, Convert.ToInt32(strImportDeclarationID), decl.DeclarationCode, strDeclarationCode2, conn, trans);
                    }
                    trans.Commit();
                    ViewState["DeclarationID"] = decl.DeclarationID.Value;
                }
                catch (Exception ex)
                {
                    ViewState.Remove("DeclarationID");
                    trans.Rollback();
                    hdMsg.Value = ex.Message;
                    return;
                }
            }

            // 获取申报项目的模板首页
            string strPartCode = strTemplateCode.Substring(2, 2) + "01";

            // 根据首页获取模板
            TempInfo = BLL.Declaration.GetTemplateInfo(strPartCode, conn);
            TempInfo.DeclarationID   = (int)ViewState["DeclarationID"];
            TempInfo.DeclarationCode = strDeclarationCode;
            if (!string.IsNullOrEmpty(strSituation))
            {
                TempInfo.Situation = (Dal.Models.EnumSituation)Enum.Parse(typeof(Dal.Models.EnumSituation), strSituation, true);
            }
            else
            {
                TempInfo.Situation = (Dal.Models.EnumSituation)Enum.Parse(typeof(Dal.Models.EnumSituation), "Declara", true);
            }

            conn.Close();

            if (TempInfo != null)
            {
                Session.Add("TemplateInfo", TempInfo);

                // 跳转到模板页
                if (strSituation == "ExpertReview" || strSituation == "Delete" || strSituation == "Auditing")
                {
                    Server.Transfer(TempInfo.NewTemplateUrl);
                }
                else
                {
                    Server.Transfer(TempInfo.TemplateUrl);
                }
            }
        }