protected void Page_Load(object sender, EventArgs e)
        {
            Response.Buffer = true;
            Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
            StimulationCheck stimuche = StimulationCheck.getNew();
            string SQLWhere = "StimulatedType='3' and StimulationId='" + stimuche.Id + "'";
            StimulationType stimtype = StimulationType.SelecByWhere(SQLWhere);
            stiforsub_coop = StimulationApplicationForSubCenterAndCollaborateUnit.FindUnitNewestAppforSub_Coop(stimtype.Id, u.UnitID);
            if (stiforsub_coop != null)
            {
                lbAppPerson.Text = stiforsub_coop.DraftWriter;
                CY.CSTS.Core.Business.UnitInfo uinfo = CY.CSTS.Core.Business.UnitInfo.Load(stiforsub_coop.UintId);
                if (uinfo != null)
                {
                    lbTel.Text = uinfo.LinkmanTel;
                    lbUnitName.Text = uinfo.UnitName;
                }
                //获取附件
                attachmentList = CY.CSTS.Core.Business.Annex.SelectAnnexByContentID(stiforsub_coop.Id);
            }
            if (!IsPostBack)
            {

                //this.SubmitApp.Attributes.Add("onclick", "javascript:return checkfill()");

                JudgeUnit();
                BindPage();

            }
        }
 protected void DeleApp_Click(object sender, EventArgs e)
 {
     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);
     StimulationAppliction stiappexist = StimulationAppliction.Load(stiforsub_coop.Id);
     stiappexist.Deleted();
     stiforsub_coop.Deleted();
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('成功删除考评申请记录!');window.location = 'StimuFP.aspx'</script>");
 }
        private void forsubaddquestion(StimulationApplicationForSubCenterAndCollaborateUnit stiforsub_coop)
        {
            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);
                List<StimulationCriterionQuestion> questlist = StimulationCriterionQuestion.GetAllStimulationCriterionQuestion() as List<StimulationCriterionQuestion>;
                questlist = questlist.Where(Item => Item.StimulationContentType == 2).ToList();
                List<StimulationCriterionAnswer> stianswerlist = new List<StimulationCriterionAnswer>();

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

                stianswerlist[0].Content = this.tb_instrument.Text.Trim();
                stianswerlist[0].Save();

                stianswerlist[1].Content = tb_instru_scale.Text.Trim();
                stianswerlist[1].Save();

                stianswerlist[2].Content = tb_instru_worktime.Text.Trim();

                stianswerlist[2].Save();

                stianswerlist[3].Content = tb_external.Text.Trim();

                stianswerlist[3].Save();

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

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

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

                if (this.affiche_badly.Checked)
                {
                    stianswerlist[7].Content = "较差";
                }
                else if (this.affiche_all_right.Checked)
                {
                    stianswerlist[7].Content = "一般";
                }
                else if (this.affiche_excellent.Checked)
                {
                    stianswerlist[7].Content = "很好";
                }
                stianswerlist[7].Save();

                stianswerlist[8].Content = tb_long_distance.Text.Trim();

                stianswerlist[8].Save();

                stianswerlist[9].Content = tbdistancemanage.Text.Trim();

                stianswerlist[9].Save();

                stianswerlist[10].Content = tbAppraise.Text.Trim();

                stianswerlist[10].Save();

                //if (long_distance_manage_verybad.Checked)
                //{
                //    stianswerlist[9].Content = "差";
                //}
                //if (this.long_distance_manage_badly.Checked)
                //{
                //    stianswerlist[9].Content = "较差";
                //}
                //else if (this.long_distance_manage_normal.Checked)
                //{
                //    stianswerlist[9].Content = "一般";
                //}
                //else if (this.long_distance_manage_excillent.Checked)
                //{
                //    stianswerlist[9].Content = "很好";
                //}
                //stianswerlist[9].Save();

                //if (appraise_none.Checked)
                //{
                //    stianswerlist[10].Content = "无";
                //}
                //if (this.appraise_badly.Checked)
                //{
                //    stianswerlist[10].Content = "差";
                //}
                //else if (this.appraise_normal.Checked)
                //{
                //    stianswerlist[10].Content = "良";
                //}
                //else if (this.appraise_excellent.Checked)
                //{
                //    stianswerlist[10].Content = "优";
                //}
                //stianswerlist[10].Save();

                if (examname == "协作单位")
                {

                    if (this.share_badly.Checked)
                    {
                        stianswerlist[11].Content = "较差";
                    }
                    else if (this.share_normal.Checked)
                    {
                        stianswerlist[11].Content = "较好";
                    }
                    else if (this.share_good.Checked)
                    {
                        stianswerlist[11].Content = "好";
                    }

                    stianswerlist[11].Save();
                }
                else
                {

                    if (subshare_badly.Checked)
                    {
                        stianswerlist[11].Content = "差";
                    }
                    if (this.subshare_normal.Checked)
                    {
                        stianswerlist[11].Content = "较差";
                    }
                    else if (this.subshare_good.Checked)
                    {
                        stianswerlist[11].Content = "较好";
                    }
                    else if (this.subshare_exellent.Checked)
                    {
                        stianswerlist[11].Content = "好";
                    }
                    stianswerlist[11].Save();
                }

                if (Rb_noneset.Checked)
                {
                    stianswerlist[12].Content = "未建设";
                }
                if (this.Rb_noneupdate.Checked)
                {
                    stianswerlist[12].Content = "未更新";
                }
                else if (this.Rb_update.Checked)
                {
                    stianswerlist[12].Content = "有更新";
                }
                else if (this.Rb_updatequarterly.Checked)
                {
                    stianswerlist[12].Content = "每季度有更新";
                }
                else if (this.Rb_updatemonthly.Checked)
                {
                    stianswerlist[12].Content = "每月有更新";
                }
                stianswerlist[12].Save();

                stianswerlist[13].Content = tb_submit.Text.Trim();
                stianswerlist[13].Save();

                stianswerlist[14].Content = tb_thesis.Text.Trim();
                stianswerlist[14].Save();

                //添加附件
                UploadFile(stiforsub_coop.Id);

            }
            catch (Exception ex)
            {

            }
        }
        private void BindPage()
        {
            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)
            {
                AnnexDataBind();
                List<StimulationCriterionQuestion> questlist = StimulationCriterionQuestion.GetAllStimulationCriterionQuestion() as List<StimulationCriterionQuestion>;
                questlist = questlist.Where(Item => Item.StimulationContentType == 2).ToList();
                List<StimulationCriterionAnswer> stianswerlist = new List<StimulationCriterionAnswer>();
                for (int i = 0; i < questlist.Count; i++)
                {

                    StimulationCriterionAnswer stianswer = StimulationCriterionAnswer.GetAnseerByQuest(questlist[i].Id, stiforsub_coop.Id);
                    if (stianswer == null)
                    {
                        stianswer = new StimulationCriterionAnswer();
                    }
                    stianswerlist.Add(stianswer);

                }
                this.tb_instrument.Text = stianswerlist[0].Content;
                this.tb_instru_scale.Text = stianswerlist[1].Content;
                tb_instru_worktime.Text = stianswerlist[2].Content;
                tb_external.Text = stianswerlist[3].Content;
                tb_income.Text = stianswerlist[4].Content;
                tb_sample.Text = stianswerlist[5].Content;
                tb_project.Text = stianswerlist[6].Content;

                switch (stianswerlist[7].Content)
                {
                    case "较差": affiche_badly.Checked = true; break;
                    case "一般": affiche_all_right.Checked = true; break;
                    case "很好": affiche_excellent.Checked = true; break;
                }

                tb_long_distance.Text = stianswerlist[8].Content;

                tbdistancemanage.Text = stianswerlist[9].Content;

                tbAppraise.Text = stianswerlist[10].Content;

                //switch (stianswerlist[9].Content)
                //{
                //    case "差": long_distance_manage_verybad.Checked = true; break;
                //    case "较差": long_distance_manage_badly.Checked = true; break;
                //    case "一般": long_distance_manage_normal.Checked = true; break;
                //    case "很好": this.long_distance_manage_excillent.Checked = true; break;
                //}

                //switch (stianswerlist[10].Content)
                //{
                //    case "无": appraise_none.Checked = true; break;
                //    case "差": appraise_badly.Checked = true; break;
                //    case "良": appraise_normal.Checked = true; break;
                //    case "优": this.appraise_excellent.Checked = true; break;
                //}
                if (examname == "协作单位")
                {
                    switch (stianswerlist[11].Content)
                    {
                        case "较差": share_badly.Checked = true; break;
                        case "较好": share_normal.Checked = true; break;
                        case "好": share_good.Checked = true; break;

                    }
                }
                else if (examname == "分中心")
                {
                    switch (stianswerlist[11].Content)
                    {
                        case "差": subshare_badly.Checked = true; break;
                        case "较差": subshare_normal.Checked = true; break;
                        case "较好": subshare_good.Checked = true; break;
                        case "好": this.subshare_exellent.Checked = true; break;
                    }

                    switch (stianswerlist[12].Content)
                    {
                        case "未建设": Rb_noneset.Checked = true; break;
                        case "未更新": Rb_noneupdate.Checked = true; break;
                        case "有更新": Rb_update.Checked = true; break;
                        case "每季度有更新": this.Rb_updatequarterly.Checked = true; break;
                        case "每月有更新": this.Rb_updatemonthly.Checked = true; break;
                    }

                    tb_submit.Text = stianswerlist[13].Content;
                    tb_thesis.Text = stianswerlist[14].Content;
                }
            }

            if (stimtype.State == 2)
            {
                this.SubmitApp.Visible = true;
                this.SaveApp.Visible = true;

                if (stiforsub_coop == null)
                {
                    this.DeleApp.Visible = false;
                }
                else
                {
                    this.DeleApp.Visible = true;
                }
                if (u != null)
                {
                    int countThisYear = CY.CSTS.Core.Business.view_INSTRUMENT.getUnitAuditInsCount(u.UnitID);
                    int count = CY.CSTS.Core.Business.view_INSTRUMENT.getUnitInsCount(u.UnitID);
                    tb_instrument.Text = count.ToString();
                    if (count == 0)
                    {
                        tb_instru_scale.Text = "0";
                    }
                    else
                    {
                        float persents = ((((float)countThisYear) / count) * 100);
                        if (persents.ToString().Length > (persents.ToString().LastIndexOf('.') + 3))
                        {
                            tb_instru_scale.Text = persents.ToString().Substring(0, persents.ToString().LastIndexOf('.') + 3);
                        }
                        else
                        {
                            tb_instru_scale.Text = persents.ToString();
                        }
                    }
                }
            }
            else if (stimtype.State == 3)
            {
                if (stiforsub_coop == null)
                {
                    this.SubmitApp.Visible = true;
                    this.SaveApp.Visible = true;
                    this.DeleApp.Visible = false;
                    if (u != null)
                    {
                        int countThisYear = CY.CSTS.Core.Business.view_INSTRUMENT.getUnitAuditInsCount(u.UnitID);
                        int count = CY.CSTS.Core.Business.view_INSTRUMENT.getUnitInsCount(u.UnitID);
                        tb_instrument.Text = count.ToString();
                        if (count == 0)
                        {
                            tb_instru_scale.Text = "0";
                        }
                        else
                        {
                            float persents = ((((float)countThisYear) / count) * 100);
                            if (persents.ToString().Length > (persents.ToString().LastIndexOf('.') + 3))
                            {
                                tb_instru_scale.Text = persents.ToString().Substring(0, persents.ToString().LastIndexOf('.') + 3);
                            }
                            else
                            {
                                tb_instru_scale.Text = persents.ToString();
                            }
                        }
                    }
                }
                else if (stiforsub_coop.State == 1)
                {
                    this.SubmitApp.Visible = true;
                    this.SaveApp.Visible = true;
                    this.DeleApp.Visible = true;
                }
                else if (stiforsub_coop.State == 4)
                {
                    this.SubmitApp.Visible = true;
                    this.SaveApp.Visible = false;
                    this.DeleApp.Visible = false;
                }
                else
                {
                    this.SubmitApp.Visible = false;
                    this.SaveApp.Visible = false;
                    this.DeleApp.Visible = false;
                }

            }
            else
            {
                this.SubmitApp.Visible = false;
                this.SaveApp.Visible = false;
                this.DeleApp.Visible = false;
            }
        }
        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('考评申请提交失败!');");

            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Context.Request.QueryString["appId"]) || !CY.Utility.Common.StringUtility.IsGuid(Request.QueryString["appId"]))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                return;
            }

            CY.CSTS.Core.Business.StimulationCheck stimulation = CY.CSTS.Core.Business.StimulationCheck.getNew();
            if (stimulation != null)
            {
                stimulationtypelist = CY.CSTS.Core.Business.StimulationType.SelectStimulationTypesByStimulationId(stimulation.Id);
            }
            for (int i = 0; i < stimulationtypelist.Count; i++)
            {
                if (stimulationtypelist.ElementAt(i).StimulatedType == 3 || stimulationtypelist.ElementAt(i).StimulatedType == 4)
                {
                    unitandsubtype = stimulationtypelist.ElementAt(i);
                }
            }
            positiontype = Context.Request.QueryString["type"];
            positionstate = Context.Request.QueryString["state"];
            id = new Guid(Context.Request.QueryString["appId"]);
            hdAppId.Value = id.ToString();
            stiforsub_coop = StimulationApplicationForSubCenterAndCollaborateUnit.Load(id);
            if (stiforsub_coop != null)
            {
                lbAppPerson.Text = stiforsub_coop.DraftWriter;
                CY.CSTS.Core.Business.UnitInfo uinfo = CY.CSTS.Core.Business.UnitInfo.Load(stiforsub_coop.UintId);
                if (uinfo != null)
                {
                    lbUnitName.Text = uinfo.UnitName;
                    lbTel.Text = uinfo.LinkmanTel;
                    if (uinfo.IsCooperantUnit == 1)
                    {
                        unitStr = "coor";
                    }
                    else
                    {
                        unitStr = "sub";
                    }
                    hdUnitType.Value = unitStr;
                }
                JudgeUnit();
                if (!IsPostBack)
                {

                    bindCtr();
                    BindPage();
                }

            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                return;
            }

            //获取附件
            attachmentList = CY.CSTS.Core.Business.Annex.SelectAnnexByContentID(id);
        }