Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ExamineStageId = RequestData.Get <string>("ExamineStageId");
            if (!string.IsNullOrEmpty(ExamineStageId))
            {
                esEnt = ExamineStage.Find(ExamineStageId);
            }
            IList <string> YearResultIds = RequestData.GetList <string>("YearResultIds");

            switch (RequestActionString)
            {
            case "Submit":
                esEnt.State = 4;
                esEnt.DoUpdate();
                break;

            case "AutoSave":
                string id          = RequestData.Get <string>("id");
                string AdviceLevel = RequestData.Get <string>("AdviceLevel");
                if (!string.IsNullOrEmpty(id))
                {
                    ExamYearResult eyrEnt = ExamYearResult.Find(id);
                    eyrEnt.AdviceLevel  = AdviceLevel;
                    eyrEnt.ApproveLevel = AdviceLevel;
                    eyrEnt.DoUpdate();
                }
                break;

            case "FindExamineStageResultId":
                IList <ExamineStageResult> esrEnts = ExamineStageResult.FindAllByProperties("Year", RequestData.Get <string>("Year"), "StageType", RequestData.Get <string>("StageType"), "UserId", RequestData.Get <string>("UserId"));
                if (esrEnts.Count > 0)
                {
                    PageState.Add("FindExamineStageResultId", esrEnts[0].Id);
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ExamineStageId = RequestData.Get <string>("ExamineStageId");
            switch (RequestActionString)
            {
            case "AutoSave":
                IList <string> entStrList = RequestData.GetList <string>("data");
                if (entStrList.Count > 0)
                {
                    JObject json = JsonHelper.GetObject <JObject>(entStrList[0]);
                    IList <ExamineStageResult> esrEnts = null;
                    ExamineStageResult         esrEnt  = null;
                    if (json.Value <int>("FirstScore") > 0)
                    {
                        esrEnts = ExamineStageResult.FindAllByProperties(ExamineStageResult.Prop_UserId, json.Value <string>("UserId"),
                                                                         ExamineStageResult.Prop_Year, "2013", ExamineStageResult.Prop_StageType, "1");
                        if (esrEnts.Count > 0)
                        {
                            esrEnts[0].Score = json.Value <decimal>("FirstScore");
                            esrEnts[0].DoUpdate();
                        }
                        else
                        {
                            esrEnt           = new ExamineStageResult();
                            esrEnt.UserId    = json.Value <string>("UserId");
                            esrEnt.UserName  = json.Value <string>("UserName");
                            esrEnt.DeptId    = json.Value <string>("DeptId");
                            esrEnt.DeptName  = json.Value <string>("DeptName");
                            esrEnt.Year      = "2013";
                            esrEnt.StageType = "1";
                            esrEnt.Score     = json.Value <decimal>("FirstScore");
                            esrEnt.DoCreate();
                        }
                    }
                    if (json.Value <int>("SecondScore") > 0)
                    {
                        esrEnts = ExamineStageResult.FindAllByProperties(ExamineStageResult.Prop_UserId, json.Value <string>("UserId"),
                                                                         ExamineStageResult.Prop_Year, "2013", ExamineStageResult.Prop_StageType, "2");
                        if (esrEnts.Count > 0)
                        {
                            esrEnts[0].Score = json.Value <decimal>("SecondScore");
                            esrEnts[0].DoUpdate();
                        }
                        else
                        {
                            esrEnt           = new ExamineStageResult();
                            esrEnt.UserId    = json.Value <string>("UserId");
                            esrEnt.UserName  = json.Value <string>("UserName");
                            esrEnt.DeptId    = json.Value <string>("DeptId");
                            esrEnt.DeptName  = json.Value <string>("DeptName");
                            esrEnt.Year      = "2013";
                            esrEnt.StageType = "2";
                            esrEnt.Score     = json.Value <decimal>("SecondScore");
                            esrEnt.DoCreate();
                        }
                    }
                    if (json.Value <int>("ThirdScore") > 0)
                    {
                        esrEnts = ExamineStageResult.FindAllByProperties(ExamineStageResult.Prop_UserId, json.Value <string>("UserId"),
                                                                         ExamineStageResult.Prop_Year, "2013", ExamineStageResult.Prop_StageType, "3");
                        if (esrEnts.Count > 0)
                        {
                            esrEnts[0].Score = json.Value <decimal>("ThirdScore");
                            esrEnts[0].DoUpdate();
                        }
                        else
                        {
                            esrEnt           = new ExamineStageResult();
                            esrEnt.UserId    = json.Value <string>("UserId");
                            esrEnt.UserName  = json.Value <string>("UserName");
                            esrEnt.DeptId    = json.Value <string>("DeptId");
                            esrEnt.DeptName  = json.Value <string>("DeptName");
                            esrEnt.Year      = "2013";
                            esrEnt.StageType = "3";
                            esrEnt.Score     = json.Value <decimal>("ThirdScore");
                            esrEnt.DoCreate();
                        }
                    }
                }
                break;

            default:
                DoSelect();
                break;
            }
        }