/// <summary> /// /// </summary> private void DoSave() { string SurveyTypeId = RequestData.Get("SurveyTypeId") + ""; string SurveyTypeName = RequestData.Get("SurveyTypeName") + ""; ent = this.GetMergedData <SurveyQuestion>(); ent.SurveyTypeId = SurveyTypeId; ent.SurveyTypeName = SurveyTypeName; ent.State = "1"; //1 启用 ent.IsFixed = "2"; //2 固定问卷 ent.DoUpdate(); if (!string.IsNullOrEmpty(SurveyId)) { IList <string> DataList = RequestData.GetList <string>("data"); if (DataList.Count > 0) { IList <QuestionItem> qiEnts = DataList.Select(tent => JsonHelper.GetObject <QuestionItem>(tent) as QuestionItem).ToArray(); foreach (QuestionItem itms in qiEnts) { itms.Content = HttpUtility.UrlDecode(itms.Content); itms.DoSave(); } } } }
private void SaveDetail(SurveyQuestion isEnt) { string temp = string.Empty; IList <string> entStrList = RequestData.GetList <string>("data"); if (entStrList != null && entStrList.Count > 0) { IList <QuestionContent> Ents = entStrList.Select(tent => JsonHelper.GetObject <QuestionContent>(tent) as QuestionContent).ToList(); foreach (QuestionContent subItem in Ents) { subItem.DoUpdate(); } } string deptId = RequestData["Dept"] + ""; string PersonId = RequestData["PersonId"] + ""; string PowerType = RequestData["PowerType"] + ""; if (!string.IsNullOrEmpty(PowerType) || deptId != "" || PersonId != "") { isEnt.ScanPower = deptId; isEnt.StatisticsPower = PersonId; isEnt.PowerType = PowerType; isEnt.DoUpdate(); } }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get("id") + ""; op = RequestData.Get("op") + ""; string SurveyTypeId = RequestData.Get("SurveyTypeId") + ""; string SurveyTypeName = RequestData.Get("SurveyTypeName") + ""; switch (RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <SurveyQuestion>(); if (string.IsNullOrEmpty(ent.State)) { ent.State = "0"; //"0" 表示创建 } ent.SurveyTypeId = SurveyTypeId; ent.SurveyTypeName = SurveyTypeName; ent.DoUpdate(); this.SetFormData(ent); break; default: if (RequestActionString == "GetTypeInfo") { GetAddFiles(); } else { DoSelect(); } break; } }
//导入模板 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); } }
/// <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(); } }
private void StopSurvery() { /*将状态设置为停止状态*/ string Id = this.RequestData.Get <string>("Id"); if (!string.IsNullOrEmpty(Id)) { SurveyQuestion Ent = SurveyQuestion.Find(Id); Ent.State = "2"; Ent.DoUpdate(); } }
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; } }
//创建流程 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); } }
/// <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(); } }
/// <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"); } }
/// <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"); } }
//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(); }