protected void SubmitApp_Click(object sender, EventArgs e)
        {
            StimulationAppliction stimuapp = new StimulationAppliction();
            try
            {

                StimulationCheck stimuche = StimulationCheck.getNew();
                string SQLWhere = "StimulatedType='3' and StimulationId='" + stimuche.Id + "'";
                stimtype = StimulationType.SelecByWhere(SQLWhere);
                stiforsub_coop = StimulationApplicationForSubCenterAndCollaborateUnit.FindUnitNewestAppforSub_Coop(stimtype.Id, u.UnitID);
                if (stiforsub_coop == null)
                {
                    stimuapp.StimulationAndTypeId = stimtype.Id;
                    stimuapp.Save();
                    stiforsub_coop = new StimulationApplicationForSubCenterAndCollaborateUnit();
                    stiforsub_coop.Id = stimuapp.Id;
                    stiforsub_coop.UintId = u.UnitID;
                    stiforsub_coop.DraftWriter = u.Name;//改
                    stiforsub_coop.FillDate = DateTime.Now;
                    stiforsub_coop.State = 2;
                    stiforsub_coop.Save();
                    forsubaddquestion(stiforsub_coop);
                }
                else
                {

                    stiforsub_coop.DraftWriter = u.Name;//改
                    stiforsub_coop.FillDate = DateTime.Now;
                    if (stiforsub_coop.State == 1)
                    {
                        stiforsub_coop.State = 2;
                    }
                    else if (stiforsub_coop.State == 4)
                    {
                        stiforsub_coop.State = 3;
                    }
                    stiforsub_coop.Save();
                    forsubaddquestion(stiforsub_coop);
                }
                Response.Redirect("StimuAppSub_CoopView.aspx");
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('考评申请提交失败!');");

            }
        }
        protected void SubmitApp_Click(object sender, EventArgs e)
        {
            StimulationAppliction stimuapp = new StimulationAppliction();
            try
            {
                //StimulationCheck stimuche = StimulationCheck.getNew();
                //string SQLWhere = "StimulatedType='2' and StimulationId='" + stimuche.Id + "'";
                //stimtype = StimulationType.SelecByWhere(SQLWhere);
                //stimuappexist = StimulationAppliction.GetStimuAppWhere("StimulationAndTypeId='" + stimtype.Id + "'");

                if (stimuappexist == null || stimuappexist.IsNew)
                {
                    stimuapp.StimulationAndTypeId = stimtype.Id;
                    stimuapp.Save();

                    StimulationApplicationForCenter appforcenter = new StimulationApplicationForCenter();

                    appforcenter.Id = stimuapp.Id;
                    appforcenter.DraftWriter = u.Name;//改
                    appforcenter.FillDate = DateTime.Now;
                    appforcenter.State = 2;
                    appforcenter.Save();
                    UploadFile(appforcenter.Id);
                    forcenteraddquestion(appforcenter);
                }
                else
                {
                    StimulationApplicationForCenter appforcenter = StimulationApplicationForCenter.Load(stimuappexist.Id);

                    appforcenter.Id = stimuappexist.Id;
                    appforcenter.DraftWriter = u.Name;//改
                    appforcenter.FillDate = DateTime.Now;
                    if (appforcenter.State == 1)
                    {
                        appforcenter.State = 2;
                    }
                    else if (appforcenter.State == 4)
                    {
                        appforcenter.State = 3;
                    }
                    appforcenter.Save();
                    UploadFile(appforcenter.Id);
                    forcenteraddquestion(appforcenter);
                }
                Response.Redirect("StimuAppServerView.aspx");

            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('考评申请提交失败!');</script>");

            }
        }
        protected void SubmitApp_Click(object sender, EventArgs e)
        {
            StimulationAppliction stimuapp = new StimulationAppliction();
            try
            {

                //StimulationCheck stimuche = StimulationCheck.getNew();
                //string sqlwhere = "StimulationId='" + stimuche.Id.ToString() + "'" + "and StimulatedType='1'";
                //stimtype = StimulationType.SelecByWhere(sqlwhere);

                //appforcrew = StimulationApplicationForCrew.FindMachineGroupNewestAppforCrew(stimtype.Id, SetID);
                if (appforcrew == null)
                {
                    stimuapp.StimulationAndTypeId = stimtype.Id;
                    stimuapp.Save();
                    appforcrew = new StimulationApplicationForCrew();
                    appforcrew.Id = stimuapp.Id;
                    appforcrew.CrewId = new Guid(SetID);
                    appforcrew.DraftWriter = u.Name;//改
                    appforcrew.FillDate = DateTime.Now;
                    appforcrew.State = 2;
                    appforcrew.Save();
                    forcrewaddquestion(appforcrew);
                }
                else
                {

                    appforcrew.DraftWriter = u.Name;//改
                    appforcrew.FillDate = DateTime.Now;
                    if (appforcrew.State == 1)
                    {
                        appforcrew.State = 2;
                    }
                    else if (appforcrew.State == 4)
                    {
                        appforcrew.State = 3;
                    }
                    else if (appforcrew.State == 8)
                    {
                        appforcrew.State = 7;
                    }
                    appforcrew.update();
                    forcrewaddquestion(appforcrew);
                }
                Response.Redirect("StimuAppSetView.aspx?SetID=" + SetID);
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('考评申请提交失败!');");

            }
        }