protected void bt_Enabled_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] != 0) { if (QNA_QuestionBLL.GetModelList("Project=" + ViewState["ID"].ToString() + " AND IsFirstQ='Y'").Count != 1) { MessageBox.Show(this, "对不起,问卷的标题中必须有,且只能有一项“问卷入口”!"); return; } if (QNA_QuestionBLL.GetModelList("Project=" + ViewState["ID"].ToString() + " AND IsLastQ='Y'").Count != 1) { MessageBox.Show(this, "对不起,问卷的标题中必须有,且只能有一项“问卷出口”!"); return; } QNA_ProjectBLL p = new QNA_ProjectBLL((int)ViewState["ID"]); p.Model.Enabled = "Y"; p.Model.UpdateStaff = (int)Session["UserID"]; p.Update(); MessageBox.ShowAndRedirect(this, "启用成功!", "QNA_ProjectList.aspx"); } }
private void BindDropDown() { DropDownList ddl_QNAProject = (DropDownList)pl_detail.FindControl("CAT_Activity_RelateQuestionnaire"); if (ddl_QNAProject != null) { ddl_QNAProject.DataSource = QNA_ProjectBLL.GetModelList("Classify = 3 AND Enabled='Y'"); ddl_QNAProject.DataTextField = "Name"; ddl_QNAProject.DataValueField = "ID"; ddl_QNAProject.DataBind(); ddl_QNAProject.Items.Insert(0, new ListItem("请选择...", "0")); } IList <AC_AccountTitle> lists; if (ConfigHelper.GetConfigInt("ActivityFeeAccountTitle2") == 0) { lists = AC_AccountTitleBLL.GetListByFeeType(ConfigHelper.GetConfigInt("HDM-CATFeeType")); } else { lists = AC_AccountTitleBLL.GetModelList("(ID = 1 OR SuperID=" + ConfigHelper.GetConfigString("ActivityFeeAccountTitle2") + ") AND MCS_SYS.dbo.UF_Spilt2('MCS_Pub.dbo.AC_AccountTitle',ExtPropertys,'IsDisable')<>'Y'"); } ddl_AccountTitle.DataSource = lists; ddl_AccountTitle.DataBind(); ddl_Brand.DataSource = PDT_BrandBLL.GetModelList("IsOpponent=1"); ddl_Brand.DataBind(); ddl_Brand.Items.Insert(0, new ListItem("请选择...", "0")); }
private void BindData() { QNA_ProjectBLL p = new QNA_ProjectBLL((int)ViewState["Project"]); lb_ProjectName.Text = p.Model.Name; ViewState["ResultStatistics"] = p.GetResultStatistics(); lb_TotalCount.Text = p.GetResultCount().ToString(); if (MCSTabControl1.SelectedIndex == 0) { rpt_Question.DataSource = QNA_QuestionBLL.GetModelList("Project=" + p.Model.ID.ToString() + " ORDER BY SortCode"); rpt_Question.DataBind(); rpt_Question.Visible = true; gv_List.Visible = false; } else { gv_List.DataSource = (DataTable)ViewState["ResultStatistics"]; gv_List.DataBind(); rpt_Question.Visible = false; gv_List.Visible = true; } }
private void BindData() { QNA_Project m = new QNA_ProjectBLL((int)ViewState["ID"]).Model; if (m != null) { pl_detail.BindData(m); if (m.Enabled == "Y") { bt_Enabled.Visible = false; } else { bt_Disabled.Visible = false; } tab_QNAToPosition.Visible = m.ToAllStaff == "N"; tab_QNAToOrganizeCity.Visible = m.ToAllOrganizeCity == "N"; ddl_FaceTo_SelectedIndexChanged(null, null); gv_List.ConditionString = "QNA_Question.Project=" + m.ID.ToString() + " ORDER BY QNA_Question.SortCode"; gv_List.BindGrid(); #region 显示所属职位,片区 if (tab_QNAToPosition.Visible) { List <int> List = new List <int>(); List = new QNA_ToPositionBLL().GetPositionByProjectID((int)ViewState["ID"]); lb_PositionChild.Items.Clear(); if (List != null) { foreach (int id in List) { Org_PositionBLL positionbll = new Org_PositionBLL(id); lb_PositionChild.Items.Add(new ListItem(positionbll.Model.Name, id.ToString())); } } } if (tab_QNAToOrganizeCity.Visible) { List <int> List = new List <int>(); List = new QNA_ToOrganizeCityBLL().GetOrganizeCityByProjectID((int)ViewState["ID"]); lb_CityChild.Items.Clear(); if (List != null) { foreach (int id in List) { Addr_OrganizeCityBLL organizeCitybll = new Addr_OrganizeCityBLL(id); lb_CityChild.Items.Add(new ListItem(organizeCitybll.Model.Name, id.ToString())); } } } #endregion } }
protected void bt_Disabled_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] != 0) { QNA_ProjectBLL p = new QNA_ProjectBLL((int)ViewState["ID"]); p.Model.Enabled = "N"; p.Model.UpdateStaff = (int)Session["UserID"]; p.Update(); MessageBox.ShowAndRedirect(this, "禁用成功!", "QNA_ProjectList.aspx"); } }
private void BindData() { QNA_ResultBLL r = new QNA_ResultBLL((int)ViewState["Result"]); if (r.Model != null) { QNA_Project p = new QNA_ProjectBLL(r.Model.Project).Model; lb_ProjectName.Text = p.Name; Repeater1.DataSource = QNA_QuestionBLL.GetModelList("Project=" + r.Model.Project.ToString() + " ORDER BY ID"); Repeater1.DataBind(); foreach (RepeaterItem _ri in Repeater1.Items) { int question = int.Parse(((Label)_ri.FindControl("lb_ID")).Text); RadioButtonList rbl_Result = (RadioButtonList)_ri.FindControl("rbl_Result"); CheckBoxList cbl_Result = (CheckBoxList)_ri.FindControl("cbl_Result"); TextBox tbx_Result = (TextBox)_ri.FindControl("tbx_Result"); foreach (QNA_Result_Detail _d in r.Items.Where <QNA_Result_Detail>(d => d.Question == question)) { if (_d.Option != 0) { if (rbl_Result.Visible) { rbl_Result.SelectedValue = _d.Option.ToString(); } else if (cbl_Result.Visible) { foreach (ListItem item in cbl_Result.Items) { if (item.Value == _d.Option.ToString()) { item.Selected = true; } } } } if (_d.OptionText != "") { tbx_Result.Visible = true; tbx_Result.Text = _d.OptionText; } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 获取页面参数 ViewState["Project"] = Request.QueryString["Project"] != null?int.Parse(Request.QueryString["Project"]) : 0; ViewState["RelateClient"] = Request.QueryString["RelateClient"] != null?int.Parse(Request.QueryString["RelateClient"]) : 0; ViewState["RelateTask"] = Request.QueryString["RelateTask"] != null?int.Parse(Request.QueryString["RelateTask"]) : 0; #endregion #region 验证问卷启用标及及出入口 if ((int)ViewState["Project"] == 0) { MessageBox.ShowAndClose(this, "对不起,参数中必须有指定的调研问卷Project!"); return; } else { QNA_Project p = new QNA_ProjectBLL((int)ViewState["Project"]).Model; if (p == null || p.Enabled == "N") { MessageBox.ShowAndClose(this, "对不起,该调研问卷未启用!"); return; } else { lb_ProjectName.Text = p.Name; if (p.DisplayType == 1) //跳转模式问卷 { Response.Redirect("QNA_FillQuestionnairA.aspx" + Request.Url.Query); return; } } } #endregion BindRepeater(); } }
private void BindProjectInfo() { QNA_Project q = new QNA_ProjectBLL((int)ViewState["Project"]).Model; if (q != null) { lb_ProjectName.Text = q.Name; #region 绑定默认下一标题控件 DropDownList ddl_DefaultNextQ = ((DropDownList)pl_detail.FindControl("QNA_Question_DefaultNextQ")); ddl_DefaultNextQ.DataTextField = "Title"; ddl_DefaultNextQ.DataValueField = "ID"; ddl_DefaultNextQ.DataSource = QNA_QuestionBLL.GetModelList("Project=" + ViewState["Project"].ToString() + " AND IsFirstQ='N' AND ID<>" + ViewState["ID"].ToString()); ddl_DefaultNextQ.DataBind(); ddl_DefaultNextQ.Items.Insert(0, new ListItem("无默认下一标题", "0")); #endregion if (q.DisplayType == 2) { //顺序显示 ddl_NextQuestion.Enabled = false; } } }
private void BindData() { QNA_ResultBLL r = new QNA_ResultBLL((int)ViewState["Result"]); if (r.Model != null) { QNA_Project p = new QNA_ProjectBLL(r.Model.Project).Model; lb_ProjectName.Text = p.Name; Repeater1.DataSource = QNA_QuestionBLL.GetModelList("Project=" + r.Model.Project.ToString() + " ORDER BY ID"); Repeater1.DataBind(); foreach (RepeaterItem _ri in Repeater1.Items) { int question = int.Parse(((Label)_ri.FindControl("lb_ID")).Text); RadioButtonList rbl_Result = (RadioButtonList)_ri.FindControl("rbl_Result"); CheckBoxList cbl_Result = (CheckBoxList)_ri.FindControl("cbl_Result"); TextBox tbx_Result = (TextBox)_ri.FindControl("tbx_Result"); foreach (QNA_Result_Detail _d in r.Items.Where<QNA_Result_Detail>(d => d.Question == question)) { if (_d.Option != 0) { if (rbl_Result.Visible) rbl_Result.SelectedValue = _d.Option.ToString(); else if (cbl_Result.Visible) { foreach (ListItem item in cbl_Result.Items) { if (item.Value == _d.Option.ToString()) item.Selected = true; } } } if (_d.OptionText != "") { tbx_Result.Visible = true; tbx_Result.Text = _d.OptionText; } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 获取页面参数 ViewState["Project"] = Request.QueryString["Project"] != null ? int.Parse(Request.QueryString["Project"]) : 0; ViewState["RelateClient"] = Request.QueryString["RelateClient"] != null ? int.Parse(Request.QueryString["RelateClient"]) : 0; ViewState["RelateTask"] = Request.QueryString["RelateTask"] != null ? int.Parse(Request.QueryString["RelateTask"]) : 0; #endregion ViewState["PreviousQuestion"] = new Stack<int>(); //上一题堆栈 ViewState["CurrentQuestion"] = 0; ViewState["NextQuestion"] = 0; ViewState["LastQuestion"] = 0; ViewState["ResultDetails"] = new List<QNA_Result_Detail>(); #region 验证问卷启用标及及出入口 if ((int)ViewState["Project"] == 0) { MessageBox.ShowAndClose(this, "对不起,参数中必须有指定的调研问卷Project!"); return; } else { QNA_Project p = new QNA_ProjectBLL((int)ViewState["Project"]).Model; if (p == null || p.Enabled == "N") { MessageBox.ShowAndClose(this, "对不起,该调研问卷未启用!"); return; } else { lb_ProjectName.Text = p.Name; if (p.DisplayType == 2) //顺序模式问卷 { Response.Redirect("QNA_FillQuestionnairB.aspx" + Request.Url.Query); return; } IList<QNA_Question> firstq = QNA_QuestionBLL.GetModelList("Project=" + p.ID.ToString() + " AND IsFirstQ='Y'"); if (firstq.Count != 1) { MessageBox.ShowAndClose(this, "对不起,该调研问卷没有正确的入口!"); return; } else { BindQuestion(firstq[0].ID); } IList<QNA_Question> lastq = QNA_QuestionBLL.GetModelList("Project=" + p.ID.ToString() + " AND IsLastQ='Y'"); if (lastq.Count != 1) { MessageBox.ShowAndClose(this, "对不起,该调研问卷没有正确的出口!"); return; } else { ViewState["LastQuestion"] = lastq[0].ID; } } } #endregion } }
private void BindData() { QNA_Project m = new QNA_ProjectBLL((int)ViewState["ID"]).Model; if (m != null) { pl_detail.BindData(m); if (m.Enabled == "Y") bt_Enabled.Visible = false; else bt_Disabled.Visible = false; tab_QNAToPosition.Visible =m.ToAllStaff == "N"; tab_QNAToOrganizeCity.Visible = m.ToAllOrganizeCity == "N"; ddl_FaceTo_SelectedIndexChanged(null, null); gv_List.ConditionString = "QNA_Question.Project=" + m.ID.ToString() + " ORDER BY QNA_Question.SortCode"; gv_List.BindGrid(); #region 显示所属职位,片区 if (tab_QNAToPosition.Visible) { List<int> List = new List<int>(); List = new QNA_ToPositionBLL().GetPositionByProjectID((int)ViewState["ID"]); lb_PositionChild.Items.Clear(); if (List != null) { foreach (int id in List) { Org_PositionBLL positionbll = new Org_PositionBLL(id); lb_PositionChild.Items.Add(new ListItem(positionbll.Model.Name, id.ToString())); } } } if (tab_QNAToOrganizeCity.Visible) { List<int> List = new List<int>(); List = new QNA_ToOrganizeCityBLL().GetOrganizeCityByProjectID((int)ViewState["ID"]); lb_CityChild.Items.Clear(); if (List != null) { foreach (int id in List) { Addr_OrganizeCityBLL organizeCitybll = new Addr_OrganizeCityBLL(id); lb_CityChild.Items.Add(new ListItem(organizeCitybll.Model.Name, id.ToString())); } } } #endregion } }
protected void bt_OK_Click(object sender, EventArgs e) { QNA_ProjectBLL _bll; if ((int)ViewState["ID"] != 0) { //修改 _bll = new QNA_ProjectBLL((int)ViewState["ID"]); } else { //新增 _bll = new QNA_ProjectBLL(); } pl_detail.GetData(_bll.Model); #region 判断必填项 if (_bll.Model.Classify == 0) { MessageBox.Show(this, "必须正确选择问卷分类!"); return; } if (_bll.Model.DisplayType == 0) { MessageBox.Show(this, "必须正确选择问卷显示方式!"); return; } if (_bll.Model.Enabled == "0") _bll.Model.Enabled = "N"; #endregion #region 判断置顶公告的截止日期 if (_bll.Model["CloseTime"] == "" || _bll.Model["CloseTime"] == "1900-01-01") { MessageBox.Show(this, "请设定问卷的截止日期!"); return; } else if (DateTime.Parse(_bll.Model["CloseTime"]) < DateTime.Today) { MessageBox.Show(this, "设定问卷的截止日期不能小于今天!"); return; } _bll.Model["CloseTime"] = DateTime.Parse(_bll.Model["CloseTime"]).ToShortDateString(); #endregion #region 判断非面向全体公告是否选择了面向职位及面向区域 if (_bll.Model.ToAllStaff == "N" && lb_PositionChild.Items.Count == 0) { MessageBox.Show(this, "请设定问卷要面向发布的职位!"); return; } if (_bll.Model.ToAllOrganizeCity == "N" && lb_CityChild.Items.Count == 0) { MessageBox.Show(this, "请设定问卷要面向发布的管理片区!"); return; } #endregion if ((int)ViewState["ID"] != 0) { //修改 _bll.Model.UpdateStaff = (int)Session["UserID"]; if (_bll.Update() == 0) { MessageBox.ShowAndRedirect(this, "修改成功!", "QNA_ProjectList.aspx"); } UpdateFaceTo(); } else { //新增 _bll.Model.InsertStaff = (int)Session["UserID"]; _bll.Model.Enabled = "N"; _bll.Model.ApproveFlag = 2; ViewState["ID"] = _bll.Add(); if (tab_QNAToPosition.Visible || tab_QNAToOrganizeCity.Visible ) AddFaceTo(); if ((int)ViewState["ID"] > 0) { MessageBox.ShowAndRedirect(this, "新增成功!", "QNA_ProjectList.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 获取页面参数 ViewState["Project"] = Request.QueryString["Project"] != null?int.Parse(Request.QueryString["Project"]) : 0; ViewState["RelateClient"] = Request.QueryString["RelateClient"] != null?int.Parse(Request.QueryString["RelateClient"]) : 0; ViewState["RelateTask"] = Request.QueryString["RelateTask"] != null?int.Parse(Request.QueryString["RelateTask"]) : 0; #endregion ViewState["PreviousQuestion"] = new Stack <int>(); //上一题堆栈 ViewState["CurrentQuestion"] = 0; ViewState["NextQuestion"] = 0; ViewState["LastQuestion"] = 0; ViewState["ResultDetails"] = new List <QNA_Result_Detail>(); #region 验证问卷启用标及及出入口 if ((int)ViewState["Project"] == 0) { MessageBox.ShowAndClose(this, "对不起,参数中必须有指定的调研问卷Project!"); return; } else { QNA_Project p = new QNA_ProjectBLL((int)ViewState["Project"]).Model; if (p == null || p.Enabled == "N") { MessageBox.ShowAndClose(this, "对不起,该调研问卷未启用!"); return; } else { lb_ProjectName.Text = p.Name; if (p.DisplayType == 2) //顺序模式问卷 { Response.Redirect("QNA_FillQuestionnairB.aspx" + Request.Url.Query); return; } IList <QNA_Question> firstq = QNA_QuestionBLL.GetModelList("Project=" + p.ID.ToString() + " AND IsFirstQ='Y'"); if (firstq.Count != 1) { MessageBox.ShowAndClose(this, "对不起,该调研问卷没有正确的入口!"); return; } else { BindQuestion(firstq[0].ID); } IList <QNA_Question> lastq = QNA_QuestionBLL.GetModelList("Project=" + p.ID.ToString() + " AND IsLastQ='Y'"); if (lastq.Count != 1) { MessageBox.ShowAndClose(this, "对不起,该调研问卷没有正确的出口!"); return; } else { ViewState["LastQuestion"] = lastq[0].ID; } } } #endregion } }
protected void bt_OK_Click(object sender, EventArgs e) { QNA_ProjectBLL _bll; if ((int)ViewState["ID"] != 0) { //修改 _bll = new QNA_ProjectBLL((int)ViewState["ID"]); } else { //新增 _bll = new QNA_ProjectBLL(); } pl_detail.GetData(_bll.Model); #region 判断必填项 if (_bll.Model.Classify == 0) { MessageBox.Show(this, "必须正确选择问卷分类!"); return; } if (_bll.Model.DisplayType == 0) { MessageBox.Show(this, "必须正确选择问卷显示方式!"); return; } if (_bll.Model.Enabled == "0") { _bll.Model.Enabled = "N"; } #endregion #region 判断置顶公告的截止日期 if (_bll.Model["CloseTime"] == "" || _bll.Model["CloseTime"] == "1900-01-01") { MessageBox.Show(this, "请设定问卷的截止日期!"); return; } else if (DateTime.Parse(_bll.Model["CloseTime"]) < DateTime.Today) { MessageBox.Show(this, "设定问卷的截止日期不能小于今天!"); return; } _bll.Model["CloseTime"] = DateTime.Parse(_bll.Model["CloseTime"]).ToShortDateString(); #endregion #region 判断非面向全体公告是否选择了面向职位及面向区域 if (_bll.Model.ToAllStaff == "N" && lb_PositionChild.Items.Count == 0) { MessageBox.Show(this, "请设定问卷要面向发布的职位!"); return; } if (_bll.Model.ToAllOrganizeCity == "N" && lb_CityChild.Items.Count == 0) { MessageBox.Show(this, "请设定问卷要面向发布的管理片区!"); return; } #endregion if ((int)ViewState["ID"] != 0) { //修改 _bll.Model.UpdateStaff = (int)Session["UserID"]; if (_bll.Update() == 0) { MessageBox.ShowAndRedirect(this, "修改成功!", "QNA_ProjectList.aspx"); } UpdateFaceTo(); } else { //新增 _bll.Model.InsertStaff = (int)Session["UserID"]; _bll.Model.Enabled = "N"; _bll.Model.ApproveFlag = 2; ViewState["ID"] = _bll.Add(); if (tab_QNAToPosition.Visible || tab_QNAToOrganizeCity.Visible) { AddFaceTo(); } if ((int)ViewState["ID"] > 0) { MessageBox.ShowAndRedirect(this, "新增成功!", "QNA_ProjectList.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 获取页面参数 ViewState["Project"] = Request.QueryString["Project"] != null ? int.Parse(Request.QueryString["Project"]) : 0; ViewState["RelateClient"] = Request.QueryString["RelateClient"] != null ? int.Parse(Request.QueryString["RelateClient"]) : 0; ViewState["RelateTask"] = Request.QueryString["RelateTask"] != null ? int.Parse(Request.QueryString["RelateTask"]) : 0; #endregion #region 验证问卷启用标及及出入口 if ((int)ViewState["Project"] == 0) { MessageBox.ShowAndClose(this, "对不起,参数中必须有指定的调研问卷Project!"); return; } else { QNA_Project p = new QNA_ProjectBLL((int)ViewState["Project"]).Model; if (p == null || p.Enabled == "N") { MessageBox.ShowAndClose(this, "对不起,该调研问卷未启用!"); return; } else { lb_ProjectName.Text = p.Name; if (p.DisplayType == 1) //跳转模式问卷 { Response.Redirect("QNA_FillQuestionnairA.aspx" + Request.Url.Query); return; } } } #endregion BindRepeater(); } }