Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Id   = RequestData.Get <string>("Id");
            type = RequestData.Get <string>("type") + "";
            string uid = RequestData.Get("uid") + "";

            SqEnt = SurveyQuestion.Find(Id);
            if (string.IsNullOrEmpty(uid))
            {
                uid = UserInfo.UserID;
            }

            switch (RequestActionString)
            {
            case "Commit":
                CommitSurvey();
                break;

            default:
                if (!string.IsNullOrEmpty(Id))
                {
                    IsHaveUser(uid);    //是否存在该用户
                    Auth(Id, uid);
                    IsPastTime(Id);
                    GetFiles();
                    RendSurveryView(Id);
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void DoSelect()
        {
            if (!string.IsNullOrEmpty(SurveyId))
            {
                ent = SurveyQuestion.Find(SurveyId);
                this.SetFormData(ent);

                string QsItem = @"select * from  FL_Culture..QuestionItem where SurveyId='{0}' order by SortIndex ";
                QsItem = string.Format(QsItem, SurveyId);

                if (string.IsNullOrEmpty(ent.TypeCode))
                {
                    string code = "HR_W" + DateTime.Now.ToString("yyyMMddHHmm");
                    this.SetFormData(new { TypeCode = code });
                }
                this.PageState.Add("DataList", DataHelper.QueryDictList(QsItem));
            }
            else
            {
                string code = "GDWJ" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Minute;
                this.SetFormData(new { TypeCode = code });
            }

            GetTemplate();
            GetTypeEnum();
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Id    = RequestData.Get <string>("Id");
            Id    = "";
            uid   = RequestData.Get("uid") + "";
            SqEnt = SurveyQuestion.Find(Id);
            if (string.IsNullOrEmpty(uid))
            {
                uid = UserInfo.UserID;
            }

            switch (RequestActionString)
            {
            case "Commit":
                CommitSurvey();
                break;

            default:
                if (!string.IsNullOrEmpty(Id))
                {
                    GetFiles();
                    RendSurveryView(Id);
                }
                break;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Id = RequestData.Get <string>("Id");
     if (!string.IsNullOrEmpty(Id))
     {
         this.PageState.Add("SurveyQuestion", SurveyQuestion.Find(Id));
         SurveyStatistic(Id);
     }
 }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Id = RequestData.Get <string>("Id");
     if (!string.IsNullOrEmpty(Id))
     {
         sqEnt             = SurveyQuestion.Find(Id);
         this.lbTitle.Text = sqEnt.Title;
         RendSurveryView(Id);
     }
 }
Ejemplo n.º 6
0
        //导入模板
        private void ImpTpl()
        {
            if (!string.IsNullOrEmpty(id))
            {
                string         TemplateId  = RequestData.Get("TemplateId") + "";
                SurveyQuestion TemplateEnt = SurveyQuestion.TryFind(TemplateId); //问卷模板
                SurveyQuestion Ent         = SurveyQuestion.Find(id);

                if (string.IsNullOrEmpty(Ent.Description) && TemplateEnt != null) //描述
                {
                    Ent.Description = TemplateEnt.Description;
                }
                Ent.TemplateId = TemplateId;
                Ent.DoUpdate();

                string SurveyId  = id;
                int    SortIndex = 1;

                string sql = "select count(1) T from FL_Culture..QuestionItem  where SurveyId='{0}' ";
                sql = string.Format(sql, SurveyId);
                object obj = DataHelper.QueryValue(sql);
                if (obj != null)
                {
                    SortIndex += int.Parse(obj.ToString());
                }

                //合并模板
                var ItemEnts = QuestionItem.FindAllByProperties(0, QuestionItem.Prop_SortIndex, QuestionItem.Prop_SurveyId, TemplateId);

                var SubItemEnts = QuestionAnswerItem.FindAllByProperties(QuestionAnswerItem.Prop_SurveyId, TemplateId);

                foreach (var ents in ItemEnts)
                {
                    QuestionItem Item = new QuestionItem();
                    Item           = ents;
                    Item.SurveyId  = SurveyId;
                    Item.SortIndex = SortIndex;
                    Item.Ext2      = "imp"; //导入标志 imp
                    Item.DoCreate();
                    SortIndex++;
                }
                foreach (var subEnt in SubItemEnts)
                {
                    QuestionAnswerItem subItem = new QuestionAnswerItem();
                    subItem          = subEnt;
                    subItem.SurveyId = SurveyId;
                    subItem.Ext1     = "imp";
                    subItem.DoCreate();
                }

                IList <QuestionItem> items = QuestionItem.FindAll(Expression.Sql(" SurveyId='" + SurveyId + "' order by SortIndex  "));
                this.PageState.Add("QItem", items);
            }
        }
        //启用状态
        private void DoStop()
        {
            string id = RequestData.Get("id") + "";

            if (!string.IsNullOrEmpty(id))
            {
                var Ent = SurveyQuestion.Find(id);
                Ent.State = "2";  //start
                Ent.DoUpdate();
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 默认查询
        /// </summary>
        private void DoSelect()
        {
            GetEduEnum();
            GetTplEnum();
            SurveyTypeEnum();
            personTypeEnum();

            SurveyQuestion ent = SurveyQuestion.Find(id);

            if (string.IsNullOrEmpty(ent.TypeCode))
            {
                ent.TypeCode = GetCode(); //设置问卷编号
            }
            if (string.IsNullOrEmpty(ent.CompanyId))
            {
                //公司与部门
                string SQL = @"select A.UserID,A.WorkNo,A.Name,B.GroupID as CropId,B.Name as CropName,
                                    C.GroupID as DeptId,C.Name as DeptName
                             from FL_PortalHR..SysUser As A
	                            left join FL_PortalHR..SysGroup As B
                              on  A.Pk_corp=B.GroupID
	                            left join  FL_PortalHR..SysGroup As C
                              on A.Pk_deptdoc=C.GroupID
                            where UserID='{0}' ";

                SQL = SQL.Replace("FL_PortalHR", Global.AimPortalDB);

                SQL = string.Format(SQL, UserInfo.UserID);
                DataTable dt = DataHelper.QueryDataTable(SQL);
                ent.CompanyId   = dt.Rows[0]["CropId"].ToString();
                ent.CompanyName = dt.Rows[0]["CropName"].ToString();

                ent.DeptId   = dt.Rows[0]["DeptId"].ToString();
                ent.DeptName = dt.Rows[0]["DeptName"].ToString();
            }

            //问题项列表
            string sql = "select * from FL_Culture..QuestionItem where SurveyId='{0}' order by SortIndex ";

            sql = string.Format(sql, id);
            var Ents = DataHelper.QueryDictList(sql);

            if (Ents.Count > 0)
            {
                this.PageState.Add("DataList_QItem", DataHelper.QueryDictList(sql));
            }

            this.SetFormData(ent);

            //调查对象
            sql = "select * from FL_Culture..SurveyedObj where SurveyId='{0}'  ";
            sql = string.Format(sql, id);
            this.PageState.Add("SurveyedObj", DataHelper.QueryDataTable(sql));
        }
Ejemplo n.º 9
0
        private void DoSelect()
        {
            if (!string.IsNullOrEmpty(SurveyId))
            {
                var Ent = SurveyQuestion.Find(SurveyId);
                if (string.IsNullOrEmpty(Ent.TemplateId))
                {
                    string sql = @"select * from  FL_Culture..QuestionItem where SurveyId='{0}' order by SortIndex ";
                    sql = string.Format(sql, SurveyId);
                    this.PageState.Add("DataList", DataHelper.QueryDictList(sql));
                }
                else
                {
                    //判断是否合并过
                    string SQL = "select * from FL_Culture..QuestionItem where SurveyId='{0}' ";
                    SQL = string.Format(SQL, SurveyId);
                    var Ents = DataHelper.QueryDictList(SQL);
                    if (Ents.Count > 0)
                    {
                        string sql = @"select * from  FL_Culture..QuestionItem where SurveyId='{0}' order by SortIndex ";
                        sql = string.Format(sql, SurveyId);
                        this.PageState.Add("DataList", DataHelper.QueryDictList(sql));
                        //SearchCriterion.SetOrder("SortIndex");
                        //IList<QuestionItem> Items = QuestionItem.FindAll(SearchCriterion, Expression.Sql(" SurveyId='" + SurveyId + "'"));
                        //this.PageState.Add("DataList", Items);
                        return;
                    }

                    //合并模板
                    var TemplateId  = Ent.TemplateId;
                    var ItemEnts    = QuestionItem.FindAllByProperties(QuestionItem.Prop_SurveyId, TemplateId);
                    var SubItemEnts = QuestionAnswerItem.FindAllByProperties(QuestionAnswerItem.Prop_SurveyId, TemplateId);

                    foreach (var ent in ItemEnts)
                    {
                        QuestionItem Item = new QuestionItem();
                        Item          = ent;
                        Item.SurveyId = SurveyId;
                        Item.DoCreate();
                    }
                    foreach (var subEnt in SubItemEnts)
                    {
                        QuestionAnswerItem subItem = new QuestionAnswerItem();
                        subItem          = subEnt;
                        subItem.SurveyId = SurveyId;
                        subItem.DoCreate();
                    }

                    SearchCriterion.SetOrder("SortIndex");
                    IList <QuestionItem> items = QuestionItem.FindAll(SearchCriterion, Expression.Sql(" SurveyId='" + SurveyId + "'"));
                    this.PageState.Add("DataList", items);
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 设置问卷有效数量
        /// </summary>
        private void DoSetCounter()
        {
            string EffectiveCount = RequestData.Get("EffectiveCount") + "";

            if (!string.IsNullOrEmpty(SurveyId) && !string.IsNullOrEmpty(EffectiveCount))
            {
                SurveyQuestion Ent = SurveyQuestion.Find(SurveyId);
                Ent.EffectiveCount = int.Parse(EffectiveCount);
                Ent.DoUpdate();
            }
        }
Ejemplo n.º 11
0
        private void StopSurvery()
        {
            /*将状态设置为停止状态*/
            string Id = this.RequestData.Get <string>("Id");

            if (!string.IsNullOrEmpty(Id))
            {
                SurveyQuestion Ent = SurveyQuestion.Find(Id);
                Ent.State = "2";
                Ent.DoUpdate();
            }
        }
Ejemplo n.º 12
0
        private void DoSelect()
        {
            personTypeEnum();
            string SurveyId = RequestData.Get("SurveyId") + "";

            if (!string.IsNullOrEmpty(SurveyId))
            {
                var    Ent  = SurveyQuestion.Find(SurveyId);
                string rObj = (Ent.ReaderObj + "").Trim(',').Replace("sender", "问卷发起者").Replace("joiner", "问卷参与者");
                string wWay = (Ent.NoticeWay + "").Trim(',').Replace("Message", "短信").Replace("Email", "邮件");
                string rWay = (Ent.RemindWay + "").Trim(',').Replace("Message", "短信").Replace("Email", "邮件");
                //是否流程审批
                string ISCheck = string.Empty;
                if (!string.IsNullOrEmpty(Ent.SurveyTypeId))
                {
                    try
                    {
                        var SType = Model.SurveyType.Find(Ent.SurveyTypeId);
                        if ((SType.MustCheckFlow + "").Contains("1"))
                        {
                            ISCheck = "是 ";
                        }
                        else
                        {
                            ISCheck = "否 ";
                        }
                        if (!string.IsNullOrEmpty(SType.ApproveRoleName))
                        {
                            ISCheck += " 审批最高层级为:" + SType.ApproveRoleName;
                        }
                    }
                    catch
                    {
                        ISCheck = "";
                    }
                }

                object Obj = new
                {
                    ISCheck    = ISCheck,
                    ReaderObj  = rObj,
                    Score      = Ent.Score,
                    NoticeWay  = wWay,
                    RemindWay  = rWay,
                    SetTimeout = Ent.SetTimeout,
                    RecyleDay  = Ent.RecyleDay,
                    TimePoint  = Ent.TimePoint
                };
                this.SetFormData(Obj);
                this.PageState.Add("SurveyedObj", DataHelper.QueryDictList("select * from FL_Culture..SurveyedObj where surveyid='" + SurveyId + "'"));
            }
        }
Ejemplo n.º 13
0
        private void DoSelect()
        {
            //问卷类型
            string SQL = @" select '' As Id, '请选择...' As TypeName
                            union all 
                            select Id,TypeName from FL_Culture..SurveyType
	                        where ( EnabledState='1' or (EnabledState='1' and (AccessPower is null or len(AccessPower)=0))) 
                            and Id in (select distinct TypeId from FL_Culture..View_SuryTypeUsr where UserID='{0}') ";

            SQL = string.Format(SQL, UserInfo.UserID);
            this.PageState.Add("TypeEnum", DataHelper.QueryDict(SQL));

            //问卷模板
            SQL = @" select Id,SurveyTitile As Name from FL_Culture..SurveyQuestion where IsFixed='1' and state='1' ";

            SQL = SQL.Replace("FL_PortalHR", Global.AimPortalDB);

            PageState.Add("tplEnum", DataHelper.QueryDict(SQL));

            if (!string.IsNullOrEmpty(id) && op != "c")
            {
                ent = SurveyQuestion.Find(id);

                if (string.IsNullOrEmpty(ent.TypeCode))
                {
                    ent.TypeCode = GetCode(); //设置问卷编号
                }
                if (string.IsNullOrEmpty(ent.CompanyId))
                {
                    //公司与部门
                    SQL = @"select A.UserID,A.WorkNo,A.Name,B.GroupID as CropId,B.Name as CropName,
                                    C.GroupID as DeptId,C.Name as DeptName
                             from FL_PortalHR..SysUser As A
	                            left join FL_PortalHR..SysGroup As B
                              on  A.Pk_corp=B.GroupID
	                            left join  FL_PortalHR..SysGroup As C
                              on A.Pk_deptdoc=C.GroupID
                            where UserID='{0}' ";

                    SQL = SQL.Replace("FL_PortalHR", Global.AimPortalDB);

                    SQL = string.Format(SQL, UserInfo.UserID);
                    DataTable dt = DataHelper.QueryDataTable(SQL);
                    ent.CompanyId   = dt.Rows[0]["CropId"].ToString();
                    ent.CompanyName = dt.Rows[0]["CropName"].ToString();

                    ent.DeptId   = dt.Rows[0]["DeptId"].ToString();
                    ent.DeptName = dt.Rows[0]["DeptName"].ToString();
                }
                this.SetFormData(ent);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            GetDeptInfo();

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = SurveyQuestion.Find(id);
                    this.SetFormData(ent);
                }
            }

            switch (RequestActionString)
            {
            case "update":
                ent = GetMergedData <SurveyQuestion>();
                //ent.Contents = toHtml(ent.Contents);
                ent.DoUpdate();
                SaveDetail(ent);
                break;

            case "create":
                ent          = this.GetPostedData <SurveyQuestion>();
                ent.State    = "0";   //已创建状态
                ent.DeptId   = DeptId;
                ent.DeptName = DeptName;
                ent.DoCreate();
                this.PageState.Add("Id", ent.Id);
                SaveDetail(ent);
                break;

            case "question":
                Create();
                break;

            case "girdBatchDel":
                DoBatchDel();
                break;

            case "close":
                DoClose();
                break;

            default:
                DoSelect();
                break;
            }
        }
Ejemplo n.º 15
0
        //创建流程
        private void StartFlow(string SurveyId)
        {
            string state    = RequestData.Get <string>("state");
            string formtype = RequestData.Get("formtype") + "";

            SurveyQuestion Ent     = SurveyQuestion.Find(SurveyId);
            string         FlowKey = "questionnaire_";         //工作流key
            string         NextUsr = string.Empty;             //下一个审批人

            SysWFUserSet UsrEnt = SysWFUserSet.FindFirstByProperties("SurveyId", SurveyId);
            int          lg     = UsrEnt.UserId1.Split(',').Length;

            FlowKey = FlowKey + lg;

            NextUsr += UsrEnt.UserId1.Split(',')[0] + "|" + UsrEnt.UserName1.Split(',')[0];

            //指定流程Key
            //if (!string.IsNullOrEmpty(Ent.WorkFlowCode))
            //{
            //    FlowKey = Ent.WorkFlowCode;
            //}
            //else
            //{
            // 根据人员 获取工作流key
            //SQL = @"select  Code  from WorkflowTemplate where TemplateName like '调查问卷%' ";
            //DataTable FlDt = DataHelper.QueryDataTable(SQL);
            //if (!string.IsNullOrEmpty(FlDt.Rows[0][0] + ""))
            //{
            //    FlowKey = (FlDt.Rows[0][0] + "").Substring(0, (FlDt.Rows[0][0] + "").Length - 1) + UserCount.Length;
            //}


            if (!string.IsNullOrEmpty(FlowKey))
            {
                string formUrl = string.Empty;
                //if (formtype.Contains("onlyView"))  //onlyView 表示固定问卷
                //{
                //formUrl = "/SurveyManage/InternetSurvey.aspx?flow=y&op=v&type=read&Id=" + SurveyId;
                //}
                //else
                //{
                formUrl = "/SurveyManage/WorkFlowTab.aspx?op=r&SurveyId=" + SurveyId;
                //}

                Guid guid = Aim.WorkFlow.WorkFlow.StartWorkFlow(SurveyId, formUrl, "调查问卷审批", FlowKey, UserInfo.UserID, UserInfo.Name);
                Ent.WorkFlowState = "Start";
                Ent.WorkFlowCode  = guid.ToString(); //InstanceId
                Ent.DoUpdate();
                this.PageState.Add("NextInfo", guid.ToString() + "$" + NextUsr);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 转存为模板
        /// </summary>
        private void TurnTempLate()
        {
            string Id = RequestData.Get <string>("SurveyId");

            if (!string.IsNullOrEmpty(Id))
            {
                //先删除
                var tplEnt = SurveyQuestion.FindFirstByProperties(SurveyQuestion.Prop_TurnSurveyId, Id, SurveyQuestion.Prop_IsFixed, "1");
                if (tplEnt != null)
                {
                    string SQL = "delete from FL_Culture..QuestionItem where SurveyId='{0}' ";
                    SQL += " delete from FL_Culture..QuestionAnswerItem where SurveyId='{0}' ";
                    SQL  = string.Format(SQL, tplEnt.Id);
                    DataHelper.ExecSql(SQL);
                    tplEnt.DoDelete();
                }

                SurveyQuestion Ent = SurveyQuestion.Find(Id);
                if (Ent != null)
                {
                    SurveyQuestion TplEnt = new SurveyQuestion();
                    TplEnt.IsFixed      = "1"; //1 模板标志位
                    TplEnt.State        = "1"; //表示启用
                    TplEnt.SurveyTitile = Ent.SurveyTitile;
                    TplEnt.Description  = Ent.Description;
                    TplEnt.TurnSurveyId = Id;
                    TplEnt.CompanyId    = Ent.CompanyId; //公司ID
                    TplEnt.CompanyName  = Ent.CompanyName;
                    TplEnt.DoCreate();

                    var tplItems    = QuestionItem.FindAllByProperties(QuestionItem.Prop_SurveyId, Id);
                    var tplSubItems = QuestionAnswerItem.FindAllByProperties(QuestionAnswerItem.Prop_SurveyId, Id);
                    foreach (var Item in tplItems)
                    {
                        QuestionItem tmpItem = new QuestionItem();
                        tmpItem          = Item;
                        tmpItem.SurveyId = TplEnt.Id;
                        tmpItem.DoCreate();
                    }
                    foreach (var SubItem in tplSubItems)
                    {
                        QuestionAnswerItem tempSubEnt = new QuestionAnswerItem();
                        tempSubEnt          = SubItem;
                        tempSubEnt.SurveyId = TplEnt.Id;
                        tempSubEnt.DoCreate();
                    }
                }
            }
        }
Ejemplo n.º 17
0
        //设置问卷有效数量
        private void EffectiveCount()
        {
            string SurveyId       = RequestData.Get("SurveyId") + "";
            string EffectiveCount = RequestData.Get("EffectiveCount") + "";

            if (!string.IsNullOrEmpty(SurveyId))
            {
                if (!string.IsNullOrEmpty(EffectiveCount))
                {
                    var Ent = SurveyQuestion.Find(SurveyId);
                    Ent.EffectiveCount = int.Parse(EffectiveCount);
                    Ent.DoUpdate();
                }
            }
        }
Ejemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IP = Request.ServerVariables.Get("Server_Name").ToString();
            string Id = RequestData.Get("Id") + "";

            switch (RequestActionString)
            {
            case "getGuid":
                GetGuid();
                break;

            case "batchdelete":
                DoBatchDelete();
                break;

            case "Start":       //启用
                if (!string.IsNullOrEmpty(Id))
                {
                    var SQEnt = SurveyQuestion.Find(Id);
                    if (SQEnt != null)
                    {
                        SQEnt.State = "1";
                        SQEnt.DoUpdate();
                    }
                }
                break;

            case "stop":      //停用
                if (!string.IsNullOrEmpty(Id))
                {
                    var SQEnt = SurveyQuestion.Find(Id);
                    if (SQEnt != null)
                    {
                        SQEnt.State = "2";
                        SQEnt.DoUpdate();
                    }
                }
                break;

            case "SetOARef":
                SetOARef();
                break;

            default:
                DoSelect();
                break;
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 审批完成
        /// </summary>
        private void SubmitFinish()
        {
            string id = RequestData.Get("SurveyId") + "";

            if (!string.IsNullOrEmpty(id))
            {
                SurveyQuestion Ent = SurveyQuestion.Find(id);
                if (Ent.IsFixed == "2")
                {
                    Ent.State = "1";                      //WGM 9/15
                }
                Ent.WorkFlowState  = "End";
                Ent.WorlFlowResult = RequestData.Get <string>("ApproveResult");
                Ent.DoUpdate();
            }
        }
Ejemplo n.º 20
0
        private void DoSelect()
        {
            if (!string.IsNullOrEmpty(SurveyId))
            {
                ent = SurveyQuestion.Find(SurveyId);
                this.SetFormData(ent);
                string sql = @"select * from  FL_Culture..QuestionItem where SurveyId='{0}' order by SortIndex ";
                sql = string.Format(sql, SurveyId);

                this.PageState.Add("DataList", DataHelper.QueryDictList(sql));
            }
            //else
            //{
            //    string code = "WJ" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Minute;
            //    this.SetFormData(new { TypeCode = code });
            //}
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 启动问卷
        /// </summary>
        public void StartSurvery(string id)
        {
            string Id = string.IsNullOrEmpty(id) ? RequestData.Get("Id") + "" : id;

            if (!String.IsNullOrEmpty(Id))
            {
                SurveyQuestion      Ent   = SurveyQuestion.Find(Id);
                StartSurveyQuestion Start = new StartSurveyQuestion();
                bool bol = Start.SurveyQuestionStart(Ent); //启动
                Ent.State   = "1";                         // 1表示启动
                Ent.EndTime = Ent.EndTime.GetValueOrDefault().AddHours(23).AddMinutes(59).AddSeconds(59);
                Ent.DoUpdate();

                BackupSurvey(Id);        //backup
                this.PageState.Add("obj", "1");
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 问卷模板授权
        /// </summary>
        private void GrantTemplate()
        {
            string Id = RequestData.Get("Id") + "";

            if (!string.IsNullOrEmpty(Id))
            {
                string         GrantCorpId   = RequestData.Get("GrantCorpId") + "";
                string         GrantCorpName = RequestData.Get("GrantCorpName") + "";
                SurveyQuestion Ent           = SurveyQuestion.Find(Id);
                Ent.GrantCorpId   = GrantCorpId;
                Ent.GrantCorpName = GrantCorpName;
                Ent.DoUpdate();
                this.PageState.Add("State", "1");
            }
            else
            {
                this.PageState.Add("State", "0");
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 删除操作
        /// </summary>
        private void DoClose()
        {
            if (!string.IsNullOrEmpty(SurveyId))
            {
                SurveyQuestion Ent = SurveyQuestion.Find(SurveyId);
                if (string.IsNullOrEmpty(Ent.SurveyTitile))
                {
                    string SQL = @"delete from  FL_Culture..QuestionAnswerItem  where Id in
                                    (
                                      select id from  FL_Culture..QuestionAnswerItem As A  where not exists (
	                                    select * from FL_Culture..QuestionItem  As B where B.SubItemId=A.QuestionItemId
                                      )    
                                    ) and SurveyId='{0}' ";
                    SQL += " delete from FL_Culture..QuestionItem where SurveyId='{0}' ";
                    SQL  = string.Format(SQL, SurveyId);
                    DataHelper.ExecSql(SQL);
                    Ent.DoDelete();
                }
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 删除操作
        /// </summary>
        private void DoClose()
        {
            string Id = RequestData.Get("Id") + "";

            if (!string.IsNullOrEmpty(Id))
            {
                SurveyQuestion Ent = SurveyQuestion.Find(Id);
                if (string.IsNullOrEmpty(Ent.SurveyTitile) && Ent.State == "0")
                {
                    string SQL = @"delete from  FL_Culture..QuestionItem where SurveyId='{0}'
                                delete from  FL_Culture..QuestionAnswerItem where SurveyId='{0}'
                                delete from  FL_Culture..SurveyFinallyUsr   where SurveyId='{0}'
                                delete from  FL_Culture..SurveyedObj  where SurveyId='{0}'
                                delete from  FL_Culture..SurveyReaderObj  where  SurveyId='{0}' ";
                    SQL = string.Format(SQL, Id);
                    DataHelper.ExecSql(SQL);
                    Ent.DoDelete();
                }
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 撤销模板
        /// </summary>
        private void CancelTpl()
        {
            string SurveyId = RequestData.Get("SurveyId") + "";
            var    Ent      = SurveyQuestion.Find(SurveyId);

            Ent.TemplateId = "";   //TemplateId
            Ent.DoUpdate();

            var ItemEnts = QuestionItem.FindAllByProperties(QuestionItem.Prop_SurveyId, SurveyId, QuestionItem.Prop_Ext2, "imp");

            if (ItemEnts.Length > 0)
            {
                //撤销模板 'imp' 导入标志
                string SQL = @"delete from FL_Culture..QuestionItem where  SurveyId='{0}' and Ext2='imp' ;
                           delete from FL_Culture..QuestionAnswerItem where SurveyId='{0}' and Ext1='imp' ";
                SQL = string.Format(SQL, SurveyId);
                DataHelper.ExecSql(SQL);

                IList <QuestionItem> items = QuestionItem.FindAll(Expression.Sql(" SurveyId='" + SurveyId + "' order by SortIndex  "));
                this.PageState.Add("QItem", items);
            }
        }
Ejemplo n.º 26
0
        private void RendSurveryView(string Id)
        {
            IList <QuestionContent> qcEnts = QuestionContent.FindAllByProperties(0, QuestionContent.Prop_SortIndex, QuestionContent.Prop_SurveyQuestionId, Id);

            if (qcEnts.Count > 0)
            {
                StringBuilder Stb = new StringBuilder();
                for (int i = 0; i < qcEnts.Count; i++)
                {
                    StringBuilder        SubStb = new StringBuilder();
                    IList <QuestionItem> qiEnts = QuestionItem.FindAllByProperties(0, QuestionItem.Prop_SortIndex, QuestionItem.Prop_QuestionContentId, qcEnts[i].Id);
                    for (int k = 0; k < qiEnts.Count; k++)
                    {
                        if (k > 0)
                        {
                            SubStb.Append(",");
                        }
                        SubStb.Append(JsonHelper.GetJsonString(qiEnts[k]));
                    }
                    qcEnts[i].QuestionItems = "[" + SubStb.ToString() + "]";
                    if (i > 0)
                    {
                        Stb.Append(",");
                    }
                    Stb.Append(JsonHelper.GetJsonString(qcEnts[i]));
                }
                this.PageState.Add("ItemList", "[" + Stb.ToString() + "]");
            }

            //string sql = @"select * from BJKY_IntegratedManage..SurveyQuestion  where Id='{0}' ";

            SurveyQuestion ent = null;

            if (!string.IsNullOrEmpty(Id))
            {
                ent = SurveyQuestion.Find(Id);
                this.PageState.Add("Survey", ent);
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 问卷视图呈现
        /// </summary>
        /// <param name="Id"></param>
        private void RendSurveryView(string Id)
        {
            IList <QuestionItem> Ents = QuestionItem.FindAllByProperties(0, QuestionItem.Prop_SortIndex, QuestionItem.Prop_SurveyId, Id);

            if (Ents.Count > 0)
            {
                StringBuilder Stb = new StringBuilder();
                for (int i = 0; i < Ents.Count; i++)
                {
                    StringBuilder SubStb = new StringBuilder();
                    IList <QuestionAnswerItem> qiEnts = QuestionAnswerItem.FindAllByProperties(0, QuestionAnswerItem.Prop_SortIndex, QuestionAnswerItem.Prop_SurveyId, Ents[i].SurveyId, QuestionAnswerItem.Prop_QuestionItemId, Ents[i].SubItemId);    //SubItemId
                    for (int k = 0; k < qiEnts.Count; k++)
                    {
                        if (k > 0)
                        {
                            SubStb.Append(",");
                        }
                        SubStb.Append(JsonHelper.GetJsonString(qiEnts[k]));
                    }
                    Ents[i].SubItems = "[" + SubStb.ToString() + "]";
                    if (i > 0)
                    {
                        Stb.Append(",");
                    }
                    Stb.Append(JsonHelper.GetJsonString(Ents[i]));
                }
                this.PageState.Add("ItemList", "[" + Stb.ToString() + "]");
            }

            SurveyQuestion ent = null;

            if (!string.IsNullOrEmpty(Id))
            {
                ent = SurveyQuestion.Find(Id);
                this.PageState.Add("Survey", ent);
            }
        }
Ejemplo n.º 28
0
        //string sql = @" select * from FL_Culture..QuestionAnswerItem where SurveyId='{0}' and QuestionItemId='{1}' order by SortIndex ";
        //      sql = string.Format(sql, SurveyId, QuestionItemId);
        //      this.PageState.Add("DataList", DataHelper.QueryDictList(sql));


        /// <summary>
        /// 问卷保存
        /// </summary>
        private void SurveyOneSave()
        {
            string SurveyId       = RequestData.Get("SurveyId") + "";
            string SurveyTypeId   = RequestData.Get("SurveyTypeId") + "";
            string SurveyTypeName = RequestData.Get("SurveyTypeName") + "";
            string NoticeWay      = RequestData.Get("NoticeWay") + "";
            string TypeCode       = RequestData.Get("TypeCode") + "";
            string SurveyTitile   = RequestData.Get("SurveyTitile") + "";
            string Description    = RequestData.Get("Description") + "";
            string StartTime      = RequestData.Get("StartTime") + "";
            string EndTime        = RequestData.Get("EndTime") + "";
            string CompanyName    = RequestData.Get("CompanyName") + "";
            string CompanyId      = RequestData.Get("CompanyId") + "";
            string DeptName       = RequestData.Get("DeptName") + "";
            string DeptId         = RequestData.Get("DeptId") + "";
            string AddFilesName   = RequestData.Get("AddFilesName") + "";
            string Score          = RequestData.Get("Score") + "";
            string SetTimeout     = RequestData.Get("SetTimeout") + "";
            string ReaderObj      = RequestData.Get("ReaderObj") + "";

            string RemindWay = RequestData.Get("RemindWay") + "";   //提醒方式
            string RecyleDay = RequestData.Get("RecyleDay") + "";   //提醒天数
            string TimePoint = RequestData.Get("TimePoint") + "";   //提醒时间点

            SurveyQuestion ent = SurveyQuestion.Find(SurveyId);

            if (string.IsNullOrEmpty(ent.State))
            {
                ent.State = "0";                                   //"0" 表示创建
            }
            ent.SurveyTypeId   = SurveyTypeId;
            ent.SurveyTypeName = SurveyTypeName;
            ent.NoticeWay      = NoticeWay;
            ent.TypeCode       = TypeCode;
            ent.SurveyTitile   = SurveyTitile;
            ent.Description    = Description;
            if (!string.IsNullOrEmpty(StartTime))
            {
                ent.StartTime = DateTime.Parse(StartTime);
            }

            if (!string.IsNullOrEmpty(EndTime))
            {
                ent.EndTime = DateTime.Parse(EndTime);
            }

            if (!string.IsNullOrEmpty(TimePoint))
            {
                ent.TimePoint = TimePoint;
            }
            if (!string.IsNullOrEmpty(RecyleDay))
            {
                ent.RecyleDay = int.Parse(RecyleDay);
            }

            if (!string.IsNullOrEmpty(CompanyName))
            {
                ent.CompanyName = CompanyName;
            }
            if (!string.IsNullOrEmpty(CompanyId))
            {
                ent.CompanyId = CompanyId;
            }

            ent.DeptName     = DeptName;
            ent.DeptId       = DeptId;
            ent.AddFilesName = AddFilesName;
            ent.RemindWay    = RemindWay;

            if (!string.IsNullOrEmpty(Score))
            {
                ent.Score = int.Parse(Score);
            }
            if (!string.IsNullOrEmpty(SetTimeout))
            {
                ent.SetTimeout = DateTime.Parse(SetTimeout);
            }
            ent.ReaderObj = ReaderObj;

            ent.DoUpdate();

            string sql = " delete from  FL_Culture..SurveyReaderObj where SurveyId='{0}' ;";

            sql = string.Format(sql, SurveyId);
            DataHelper.ExecSql(sql);

            string ReadObj = ent.ReaderObj;

            if (ReadObj.Contains("joiner"))
            {
                ReadObj = "joiner";
            }
            else
            {
                ReadObj = "sender";
            }

            SurveyReaderObj ReadEnt = new SurveyReaderObj();

            ReadEnt.SurveyId  = SurveyId;
            ReadEnt.ReaderWay = ReadObj;
            ReadEnt.DoCreate();
        }
Ejemplo n.º 29
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();
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// SaveSurveyedObj
        /// </summary>
        private void SaveSurveyedObj()
        {
            string SurveyId = RequestData.Get("SurveyId") + "";
            //first delete
            string sql = " delete from  FL_Culture..SurveyedObj where SurveyId='{0}' ;";

            sql += " delete from  FL_Culture..SurveyReaderObj where SurveyId='{0}' ;";
            sql  = string.Format(sql, SurveyId);
            DataHelper.ExecSql(sql);

            string OrgIds          = RequestData.Get("OrgIds") + "";
            string OrgNames        = RequestData.Get("OrgNames") + "";
            string PostionIds      = RequestData.Get("PostionIds") + "";
            string PostionNames    = RequestData.Get("PostionNames") + "";
            string BornAddr        = RequestData.Get("BornAddr") + "";
            string StartWorkTime   = RequestData.Get("StartWorkTime") + "";
            string UntileWorkTime  = RequestData.Get("UntileWorkTime") + "";
            string Sex             = RequestData.Get("Sex") + "";
            string StartAge        = RequestData.Get("StartAge") + "";
            string EndAge          = RequestData.Get("EndAge") + "";
            string WorkAge         = RequestData.Get("WorkAge") + "";
            string Major           = RequestData.Get("Major") + "";
            string PersonType      = RequestData.Get("PersonType") + "";
            string PositionDegree1 = RequestData.Get("PositionDegree1") + "";
            string PositionDegree0 = RequestData.Get("PositionDegree0") + "";
            string CruxPositon     = RequestData.Get("CruxPositon") + ""; //关键岗位
            string PositionSeq     = RequestData.Get("PositionSeq") + ""; //岗位序列

            SurveyedObj Ent = new SurveyedObj();

            Ent.SurveyId     = SurveyId;        //*
            Ent.OrgIds       = OrgIds;
            Ent.OrgNames     = OrgNames;
            Ent.PostionIds   = PostionIds;
            Ent.PostionNames = PostionNames;
            Ent.Sex          = Sex;
            Ent.WorkAge      = WorkAge;
            if (!string.IsNullOrEmpty(StartWorkTime))
            {
                Ent.StartWorkTime = DateTime.Parse(StartWorkTime);
            }
            if (!string.IsNullOrEmpty(UntileWorkTime))
            {
                Ent.UntileWorkTime = DateTime.Parse(UntileWorkTime);
            }
            if (!string.IsNullOrEmpty(CruxPositon))
            {
                Ent.CruxPositon = CruxPositon;
            }
            if (!string.IsNullOrEmpty(PositionSeq))
            {
                Ent.PositionSeq = PositionSeq; //岗位序列
            }
            Ent.Major      = Major;            //学历
            Ent.PersonType = PersonType;
            Ent.BornAddr   = BornAddr;

            //年龄范围
            if (!string.IsNullOrEmpty(StartAge))
            {
                Ent.StartAge = DateTime.Parse(StartAge);
            }
            if (!string.IsNullOrEmpty(EndAge))
            {
                Ent.EndAge = DateTime.Parse(EndAge);
            }

            //StartAge EndAge(年龄范围) BornAddr 籍贯
            Ent.PositionDegree0 = PositionDegree0;
            Ent.PositionDegree1 = PositionDegree1;
            Ent.DoCreate();

            SurveyQuestion SEnt    = SurveyQuestion.Find(SurveyId);
            string         ReadObj = SEnt.ReaderObj;

            if (ReadObj.Contains("joiner"))
            {
                ReadObj = "joiner";
            }
            else
            {
                ReadObj = "sender";
            }

            SurveyReaderObj ReadEnt = new SurveyReaderObj();

            ReadEnt.SurveyId  = SurveyId;
            ReadEnt.ReaderWay = ReadObj;
            ReadEnt.DoCreate();

            this.PageState.Add("State", "1");
        }