Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SurveyCommitHistory ent = null;

            switch (this.RequestActionString)
            {
            case "getScoreInfo":
                // DoGetScoreInfo();
                break;

            default:
                DoSelect();
                break;
            }
        }
Exemplo n.º 2
0
        private void CommitSurvey()
        /*存储提交的调查问卷数据*/
        {
            string         CommitHistory = this.RequestData.Get <string>("CommitHistory");
            IList <string> list          = this.RequestData.GetList <string>("commitArr");

            if (list.Count > 0 && !string.IsNullOrEmpty(CommitHistory))
            {
                IList <SurveyResult> ents  = list.Select(ten => JsonHelper.GetObject <SurveyResult>(ten) as SurveyResult).ToArray();
                SurveyCommitHistory  shEnt = JsonHelper.GetObject <SurveyCommitHistory>(CommitHistory);
                foreach (var v in ents)
                {
                    v.DoCreate();
                }
                shEnt.DoCreate();
            }
        }
Exemplo n.º 3
0
        private void GetCommitSurvey()
        {
            string SurveyId = this.RequestData.Get <string>("SurveyId");

            if (!string.IsNullOrEmpty(SurveyId))
            {
                if (!string.IsNullOrEmpty(this.RequestData.Get <string>("UserId")))
                {
                    SurveyCommitHistory Ent = SurveyCommitHistory.FindFirstByProperties(SurveyCommitHistory.Prop_SurveyId, SurveyId, SurveyCommitHistory.Prop_SurveyedUserId, this.RequestData.Get <string>("UserId"));
                    if (Ent != null)
                    {
                        string str = string.IsNullOrEmpty(Ent.CommitSurvey) ? "" : Ent.CommitSurvey;
                        try
                        {
                            int start = str.IndexOf("<SCRIPT type=text/javascript src=\"js/renderSurvey.js\"></SCRIPT>");
                            int end   = str.IndexOf("</HEAD>");
                            str = str.Remove(start, end - start);
                            str = str.Replace("commit()", "");
                            str = str.Replace("cancel()", "");
                            Response.Write(str);
                        }
                        catch (Exception e)
                        {
                            Response.Write(str);
                        }
                    }
                }
                else
                {
                    SurveyCommitHistory Ent = SurveyCommitHistory.FindFirstByProperties(SurveyCommitHistory.Prop_SurveyId, SurveyId, SurveyCommitHistory.Prop_SurveyedUserId, UserInfo.UserID);
                    if (Ent != null)
                    {
                        string str = string.IsNullOrEmpty(Ent.CommitSurvey) ? "" : Ent.CommitSurvey;

                        int start = str.IndexOf("<SCRIPT type=text/javascript src=\"js/renderSurvey.js\"></SCRIPT>");
                        int end   = str.IndexOf("</HEAD>");
                        str = str.Remove(start, end - start);
                        Response.Write(str);
                        // Response.Write(string.IsNullOrEmpty(Ent.CommitSurvey) ? "" : Ent.CommitSurvey);
                    }
                }
            }
            //Response.End();
        }
        private void GetCommitSurvey()
        {
            string SurveyId = this.RequestData.Get <string>("SurveyId");

            if (!string.IsNullOrEmpty(SurveyId))
            {
                if (!string.IsNullOrEmpty(this.RequestData.Get <string>("UserId")))
                {
                    SurveyCommitHistory Ent = SurveyCommitHistory.FindFirstByProperties(SurveyCommitHistory.Prop_SurveyId, SurveyId, SurveyCommitHistory.Prop_SurveyedUserId, this.RequestData.Get <string>("UserId"));
                    if (Ent != null)
                    {
                        Response.Write(string.IsNullOrEmpty(Ent.CommitSurvey) ? "" : Ent.CommitSurvey);
                    }
                }
                else
                {
                    SurveyCommitHistory Ent = SurveyCommitHistory.FindFirstByProperties(SurveyCommitHistory.Prop_SurveyId, SurveyId, SurveyCommitHistory.Prop_SurveyedUserId, UserInfo.UserID);
                    if (Ent != null)
                    {
                        Response.Write(string.IsNullOrEmpty(Ent.CommitSurvey) ? "" : Ent.CommitSurvey);
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void CommitSurvey()
        /*存储提交的调查问卷数据*/
        {
            string         CommitHistory = this.RequestData.Get <string>("CommitHistory");
            IList <string> list          = this.RequestData.GetList <string>("commitArr");

            if (list.Count > 0 && !string.IsNullOrEmpty(CommitHistory))
            {
                IList <SurveyedResult> ents  = list.Select(ten => JsonHelper.GetObject <SurveyedResult>(ten) as SurveyedResult).ToArray();
                SurveyCommitHistory    shEnt = JsonHelper.GetObject <SurveyCommitHistory>(CommitHistory);

                if (!string.IsNullOrEmpty(shEnt.SurveyedUserId))
                {
                    var UserEnt = SysUser.Find(shEnt.SurveyedUserId);
                    shEnt.WorkNo           = UserEnt.WorkNo;
                    shEnt.SurveyedUserName = UserEnt.Name;
                }

                try
                {
                    foreach (var v in ents)
                    {
                        v.DoCreate();
                    }
                }
                catch (Exception ex)
                {
                    string SQL = "delete from FL_Culture..SurveyedResult where SurveyId='{0}' and UserId='{1}' ";
                    SQL = string.Format(SQL, Id, uid);
                    DataHelper.ExecSql(SQL);
                }

                int    totalScore = -1;           //计算总分  -1 表示无分值项
                string SocreInfo  = string.Empty; // 分值总分

                var Ents = QuestionAnswerItem.FindAllByProperties(QuestionAnswerItem.Prop_SurveyId, shEnt.SurveyId);
                QuestionAnswerItem[] QArr = Ents.Where(ten => ten.Score.HasValue).ToArray();
                if (QArr.Length > 0)
                {
                    string sql = "select FL_Culture.dbo.f_SumSurveyScore('{0}','{1}') As TotalScore";
                    sql = string.Format(sql, shEnt.SurveyId, shEnt.SurveyedUserId);
                    object obj = DataHelper.QueryValue(sql);

                    int tryVal = 0;
                    if (int.TryParse(obj.ToString(), out tryVal))
                    {
                        tryVal = int.Parse(obj.ToString());
                    }
                    totalScore = tryVal;
                    SocreInfo  = GetScoreInfo(shEnt.SurveyId, shEnt.SurveyedUserId);
                }

                //添加积分项
                SurveyQuestion SQ = SurveyQuestion.Find(shEnt.SurveyId);
                if (SQ.Score.HasValue)
                {
                    SurveyScore Score = new SurveyScore();
                    Score.Score    = SQ.Score;
                    Score.Sign     = "s";
                    Score.UserID   = shEnt.SurveyedUserId;
                    Score.UserName = shEnt.SurveyedUserName;
                    Score.Detail   = SQ.SurveyTitile;
                    Score.Ext1     = SQ.Id;//SurveyId
                    Score.DoCreate();
                }

                shEnt.TotalScore = totalScore;
                shEnt.ScoreInfo  = SocreInfo;

                shEnt.DoCreate();
            }
        }