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>");

            }
        }
        private void forcenteraddquestion(StimulationApplicationForCenter appforcenter)
        {
            try
            {

                //StimulationCheck stimuche = StimulationCheck.getNew();
                //string SQLWhere = "StimulatedType='2' and StimulationId='" + stimuche.Id + "'";
                //stimtype = StimulationType.SelecByWhere(SQLWhere);
                //stimuappexist = StimulationAppliction.GetStimuAppWhere("StimulationAndTypeId='" + stimtype.Id + "'");
                List<StimulationCriterionQuestion> questlist = StimulationCriterionQuestion.GetAllStimulationCriterionQuestion() as List<StimulationCriterionQuestion>;
                questlist = questlist.Where(Item => Item.StimulationContentType == 1).ToList();
                List<StimulationCriterionAnswer> stianswerlist = new List<StimulationCriterionAnswer>();

                for (int i = 0; i < questlist.Count; i++)
                {
                    StimulationCriterionAnswer stianswer = StimulationCriterionAnswer.GetAnseerByQuest(questlist[i].Id, appforcenter.Id);
                    if (stianswer == null)
                    {
                        stianswer = new StimulationCriterionAnswer();
                        stianswer.QuestionID = questlist[i].Id;
                        stianswer.ApplicationId = appforcenter.Id;
                    }

                    stianswerlist.Add(stianswer);
                }

                if (this.workpoint_badly.Checked)
                {

                    stianswerlist[0].Content = "完成较差";
                }
                else if (this.workpoint_commonly.Checked)
                {
                    stianswerlist[0].Content = "大部分完成";
                }
                else if (this.workpoint_all_right.Checked)
                {
                    stianswerlist[0].Content = "较好完成";
                }
                else if (this.workpoint_excellence.Checked)
                {
                    stianswerlist[0].Content = "完成好";
                }
                stianswerlist[0].Save();

                if (this.Web_badly.Checked)
                {
                    stianswerlist[1].Content = "差";
                }
                else if (this.Web_all_right.Checked)
                {
                    stianswerlist[1].Content = "一般";
                }
                else if (this.Web_excellence.Checked)
                {
                    stianswerlist[1].Content = "好";
                }
                stianswerlist[1].Save();

                if (this.Database_lot_error.Checked)
                {
                    stianswerlist[2].Content = "差错较多";
                }
                else if (this.Database_little_error.Checked)
                {
                    stianswerlist[2].Content = "少量差错";
                }
                else if (this.Database_no_error.Checked)
                {
                    stianswerlist[2].Content = "无差错";
                }
                stianswerlist[2].Save();

                if (this.Server_badly.Checked)
                {
                    stianswerlist[3].Content = "完成差";
                }
                else if (this.Server_all_right.Checked)
                {
                    stianswerlist[3].Content = "基本完成";
                }
                else if (this.Server_excellence.Checked)
                {
                    stianswerlist[3].Content = "完成计划运行好";
                }
                stianswerlist[3].Save();

                stianswerlist[4].Content = tb_newinstrument.Text.Trim();
                stianswerlist[4].Save();

                stianswerlist[5].Content = tb_flack.Text.Trim();
                stianswerlist[5].Save();

                stianswerlist[6].Content = tb_analyse.Text.Trim();
                stianswerlist[6].Save();

                stianswerlist[7].Content = tb_satisf.Text.Trim();
                stianswerlist[7].Save();

                if (this.office_badly.Checked)
                {
                    stianswerlist[8].Content = "差";
                }
                else if (this.office_all_right.Checked)
                {
                    stianswerlist[8].Content = "一般";
                }
                else if (this.office_excellent.Checked)
                {
                    stianswerlist[8].Content = "好";
                }
                stianswerlist[8].Save();

            }
            catch (Exception ex)
            {

            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Context.Request.QueryString["state"] != null)
            {
                state = Request.QueryString["state"];

            }
            if (Context.Request.QueryString["type"] != null)
            {
                type = Request.QueryString["type"];
            }
            if (Session["User"] != null)
            {
                U = (CY.CSTS.Core.Business.User)Session["User"];
            }
            else
            {

            }

            StimulationCheck stimuche = StimulationCheck.getNew();
            string SQLWhere = "StimulatedType='2' and StimulationId='" + stimuche.Id + "'";
            stimtype = StimulationType.SelecByWhere(SQLWhere);

            StimulationAppliction stimuappexist = StimulationAppliction.GetStimuAppWhere("StimulationAndTypeId='" + stimtype.Id + "'");
            if (stimuappexist != null)
            {
                attachmentList = CY.CSTS.Core.Business.Annex.SelectAnnexByContentID(stimuappexist.Id);
                appforcenter = StimulationApplicationForCenter.Load(stimuappexist.Id);
                if (appforcenter != null)
                {
                    if (!IsPostBack)
                    {
                        hdAppId.Value = appforcenter.Id.ToString();
                        bindCtr();
                        Bindpage();
                    }
                }
            }
        }