protected void Page_Load(object sender, EventArgs e)
        {
            Response.Buffer = true;
            Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
            try
            {
                SetID = Request.QueryString["SetID"];

                System.Guid Setid = System.Guid.Empty;
                if (SetID != null && CY.Utility.Common.StringUtility.IsGuid(SetID.ToString()) && (Setid = new Guid(SetID.ToString())) != System.Guid.Empty)
                {
                    CY.CSTS.Core.Business.MACHINESET mset = CY.CSTS.Core.Business.MACHINESET.Load(Setid);
                    if (mset != null)
                    {
                        if (mset.JointreviewStateName == "未申请")
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('未申请');this.close();</script>");
                            return;
                        }
                        if (mset.UnitID != null)
                        {
                            IList<CY.CSTS.Core.Business.User> users = CY.CSTS.Core.Business.User.GetUnitUserList(mset.UnitID);
                            for (int i = 0; i < users.Count; i++)
                            {
                                if (users[i].UserType == 6 || users[i].UserType == 7)
                                {
                                    lbUserName.Text = users[i].Name;
                                    lbUserTel.Text = users[i].Phone;
                                    break;
                                }

                            }
                        }
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('未申请');window.location = 'StimuFP.aspx';</script>");
                        return;
                    }
                }

                StimulationCheck stimuche = StimulationCheck.getNew();
                string sqlwhere = "StimulationId='" + stimuche.Id.ToString() + "' and [StimulatedType]='1'";
                stimtype = StimulationType.SelecByWhere(sqlwhere);
                stiforcrew = StimulationApplicationForCrew.FindMachineGroupNewestAppforCrew(stimtype.Id, SetID);
                if (stiforcrew != null)
                {
                    CY.CSTS.Core.Business.MACHINESET mset = CY.CSTS.Core.Business.MACHINESET.Load(stiforcrew.CrewId);
                    if (mset != null)
                    {
                        lbSetName.Text = mset.SETNAME;
                        lbUnit.Text = mset.Unit.UnitName;
                        lbInsCode.Text = mset.InsSysCode.ToString();
                        lbSetLinkman.Text = mset.LINKMAN;
                        lbTel.Text = mset.PHONE;
                    }
                    //获取附件
                    attachmentList = CY.CSTS.Core.Business.Annex.SelectAnnexByContentID(stiforcrew.Id);
                }

                if (!IsPostBack)
                {

                    if (Session["User"] != null)
                    {

                        BindPage();
                    }

                }

            }
            catch (Exception ex)
            {
                //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('页面加载错误!将返回网站主页');window.location = '../../home.aspx'</script>");
                //return;
                throw ex;
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Context.Request.QueryString["type"] != null)
            {
                type = Request.QueryString["type"];

            }
            if (Context.Request.QueryString["state"] != null)
            {
                state = Request.QueryString["state"];
            }

            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;
            }
            // SetID = Request.QueryString["SetID"];
            id = new Guid(Context.Request.QueryString["appId"]);
            StimulationCheck stimuche = StimulationCheck.getNew();
            string sqlwhere = "StimulationId='" + stimuche.Id.ToString() + "'" + "and StimulatedType='1'";
            StimulationType stimtype = StimulationType.SelecByWhere(sqlwhere);

            stiforcrew = StimulationApplicationForCrew.Load(id);
            appforcrewid = stiforcrew.Id.ToString();
            if (stiforcrew != null)
            {
                CY.CSTS.Core.Business.MACHINESET mset = CY.CSTS.Core.Business.MACHINESET.Load(stiforcrew.CrewId);
                if (mset != null)
                {
                    lbSetName.Text = mset.SETNAME;
                    if (mset.UnitID != null)
                    {
                        IList<CY.CSTS.Core.Business.User> users = CY.CSTS.Core.Business.User.GetUnitUserList(mset.UnitID);
                        for (int i = 0; i < users.Count; i++)
                        {
                            if (users[i].UserType == 6 || users[i].UserType == 7)
                            {
                                lbUserName.Text = users[i].Name;
                                lbUserTel.Text = users[i].Phone;
                                break;
                            }

                        }
                    }
                    lbUnit.Text = mset.Unit.UnitName;
                    lbInsCode.Text = mset.InsSysCode.ToString();
                    lbSetLinkman.Text = mset.LINKMAN;
                    lbTel.Text = mset.PHONE;
                }
                if (!IsPostBack)
                {
                    hdAppId.Value = stiforcrew.Id.ToString();
                    BindPage();
                    bindCtr();
                }

            }
            //获取附件
            attachmentList = CY.CSTS.Core.Business.Annex.SelectAnnexByContentID(id);
        }
        private void forcrewaddquestion(StimulationApplicationForCrew appforcrew)
        {
            try
            {
                //StimulationCheck stimuche = StimulationCheck.getNew();
                //string sqlwhere = "StimulationId='" + stimuche.Id.ToString() + "'" + "and StimulatedType='1'";
                //stimtype = StimulationType.SelecByWhere(sqlwhere);

                //appforcrew = StimulationApplicationForCrew.FindMachineGroupNewestAppforCrew(stimtype.Id, SetID);
                List<StimulationCriterionQuestion> questlist = StimulationCriterionQuestion.GetAllStimulationCriterionQuestion() as List<StimulationCriterionQuestion>;
                questlist = questlist.Where(Item => Item.StimulationContentType == 3).ToList();
                List<StimulationCriterionAnswer> stianswerlist = new List<StimulationCriterionAnswer>();

                for (int i = 0; i < questlist.Count; i++)
                {

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

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

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

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

                stianswerlist[2].Save();

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

                stianswerlist[3].Save();

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

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

                stianswerlist[6].Content = tb_litigate.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();

                if (this.log_none.Checked)
                {
                    stianswerlist[8].Content = "无记录";
                }
                else if (this.log_lotlose.Checked)
                {
                    stianswerlist[8].Content = "大部分缺失";
                }
                else if (this.log_littlelose.Checked)
                {
                    stianswerlist[8].Content = "少量缺失";
                }
                else if (this.log_full.Checked)
                {
                    stianswerlist[8].Content = "完整";
                }
                stianswerlist[8].Save();
                if (this.case_no.Checked)
                {
                    stianswerlist[9].Content = "无";
                }
                else if (this.case_yes.Checked)
                {
                    stianswerlist[9].Content = "有";
                }

                stianswerlist[9].Save();

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

                stianswerlist[11].Content = tbachievement_excellent.Text.Trim();
                stianswerlist[11].Save();

                //if (this.achievement_bad.Checked)
                //{
                //    stianswerlist[11].Content = "一般";
                //}
                //else if (this.achievement_normal.Checked)
                //{
                //    stianswerlist[11].Content = "较好";
                //}
                //else if (this.achievement_excellent.Checked)
                //{
                //    stianswerlist[11].Content = "突出";
                //}

                //stianswerlist[11].Save();

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

                UploadFile(appforcrew.Id);//上传附件
            }
            catch (Exception ex)
            {

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Buffer = true;
            Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
            if (Request.QueryString["SetID"] != null && Request.QueryString["SetID"] != "")
            {
                SetID = Request.QueryString["SetID"];
                if (Request.QueryString["type"] != null && Request.QueryString["type"] == "1")
                {
                    System.Guid Setid = System.Guid.Empty;
                    if (SetID != null && CY.Utility.Common.StringUtility.IsGuid(SetID.ToString()) && (Setid = new Guid(SetID.ToString())) != System.Guid.Empty)
                    {
                        CY.CSTS.Core.Business.MACHINESET mset = CY.CSTS.Core.Business.MACHINESET.Load(Setid);
                        if (mset != null)
                        {
                            if (mset.JointreviewStateName != "未申请")
                            {
                                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('已申请!');window.location = 'StimuFP.aspx';</script>");
                                return;
                            }
                        }
                    }
                }
                StimulationCheck stimuche = StimulationCheck.getNew();
                string sqlwhere = "StimulationId='" + stimuche.Id.ToString() + "'" + "and StimulatedType='1'";
                stimtype = StimulationType.SelecByWhere(sqlwhere);

                appforcrew = StimulationApplicationForCrew.FindMachineGroupNewestAppforCrew(stimtype.Id, SetID);
                if (!IsPostBack)
                {
                    this.SubmitApp.Attributes.Add("onclick", "javascript:return checkfill()");
                    if (string.IsNullOrEmpty(Context.Request.QueryString["SetID"]) || !CY.Utility.Common.StringUtility.IsGuid(Request.QueryString["SetID"]))
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                        return;
                    }

                    BindPage();

                }
            }
        }
        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('考评申请提交失败!');");

            }
        }