// GET: Admin/TypeManager public ActionResult Index(int page = 1, int pageSize = 5) { var dao = new TypeDao(); var model = dao.ListAll(page, pageSize); return(View(model)); }
public void Submit_OnClick(object sender, EventArgs e) { TypeInfo typeInfo = null; if (_id > 0) { try { typeInfo = TypeDao.GetTypeInfo(_id); if (typeInfo != null) { if (typeInfo.TypeName == TbTypeName.Text) { LtlMessage.Text = Utils.GetMessageHtml("办件类型名称不能与原来相同!", false); } else { var typeNameArrayList = TypeDao.GetTypeNameList(_channelId); if (typeNameArrayList.IndexOf(TbTypeName.Text) != -1) { LtlMessage.Text = Utils.GetMessageHtml($"办件类型添加失败,办件类型名称已存在!", false); } else { typeInfo.TypeName = TbTypeName.Text; TypeDao.Update(typeInfo); LtlMessage.Text = Utils.GetMessageHtml("办件类型修改成功!", true); LayerUtils.Close(Page); } } } } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml($"办件类型修改失败,{ex.Message}", false); } } else { var typeNameArrayList = TypeDao.GetTypeNameList(_channelId); if (typeNameArrayList.IndexOf(TbTypeName.Text) != -1) { LtlMessage.Text = Utils.GetMessageHtml($"办件类型添加失败,办件类型名称已存在!", false); } else { try { typeInfo = new TypeInfo(0, TbTypeName.Text, _channelId, SiteId, 0); TypeDao.Insert(typeInfo); LtlMessage.Text = Utils.GetMessageHtml("办件类型添加成功!", true); LayerUtils.Close(Page); } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml($"办件类型添加失败,{ex.Message}", false); } } } }
//查看已发布的问题 public ActionResult MyPublish() { MyPublishModel model = new MyPublishModel(); UserDao userdao = new UserDao(); User user = userdao.getById(int.Parse(Request.Cookies["Menber"].Values["ID"])); QuestionDao questiondao = new QuestionDao(); model.questions = questiondao.getByUser(user); TypeDao typedao = new TypeDao(); model.types = typedao.getTypeList(); return(View(model)); }
public void Page_Load(object sender, EventArgs e) { _channelId = Utils.ToInt(Request.QueryString["channelId"]); _id = Utils.ToInt(Request.QueryString["id"]); if (!IsPostBack) { if (_id > 0) { var typeInfo = TypeDao.GetTypeInfo(_id); if (typeInfo != null) { TbTypeName.Text = typeInfo.TypeName; } } } }
public ActionResult Index() { IndexModel model = new IndexModel(); TypeDao typedao = new TypeDao(); model.types = typedao.getTypeList(); QuestionDao questiondao = new QuestionDao(); model.questions = questiondao.getAll(0, 6); for (int i = 0; i < model.questions.Count; i++) { model.questions[i].optionData = questiondao.getOptionData(model.questions[i]).Replace(" ", "").Replace("\n", "").Replace("\t", "").Replace("\r", ""); model.questions[i].voteCount = questiondao.getVoteCount(model.questions[i]); } return(View(model)); }
public ActionResult AddType(THELOAI tk) { if (ModelState.IsValid) { var DAO = new TypeDao(); tk.UrlRequire = RewriteURL.RewriteUrl(tk.UrlRequire); long id = DAO.addType(tk); if (id > 0) { return(RedirectToAction("Index", "TypeManager")); } else { ModelState.AddModelError("", "Thêm thể loại thất bại"); } } return(View("Index")); }
public static void AddDefaultTypeInfos(int siteId, int channelId) { var typeInfo = new TypeInfo(0, "求决", channelId, siteId, 0); TypeDao.Insert(typeInfo); typeInfo = new TypeInfo(0, "举报", channelId, siteId, 0); TypeDao.Insert(typeInfo); typeInfo = new TypeInfo(0, "投诉", channelId, siteId, 0); TypeDao.Insert(typeInfo); typeInfo = new TypeInfo(0, "咨询", channelId, siteId, 0); TypeDao.Insert(typeInfo); typeInfo = new TypeInfo(0, "建议", channelId, siteId, 0); TypeDao.Insert(typeInfo); typeInfo = new TypeInfo(0, "感谢", channelId, siteId, 0); TypeDao.Insert(typeInfo); typeInfo = new TypeInfo(0, "其他", channelId, siteId, 0); TypeDao.Insert(typeInfo); }
public ActionResult UpdateType(THELOAI tk) { if (ModelState.IsValid) { var DAO = new TypeDao(); //var passmd5 = Encryptor.MD5Hash(tk.MatKhau); //tk.MatKhau = passmd5; var result = DAO.updateType(tk); if (result) { return(RedirectToAction("Index", "TypeManager")); } else { ModelState.AddModelError("", "Cập nhật thất bại"); } } return(View("Index")); }
public void Page_Load(object sender, EventArgs e) { channelId = Utils.ToInt(Request.QueryString["channelId"]); var id = Convert.ToInt32(Request.QueryString["id"]); if (!IsPostBack && channelId > 0) { if (Request.QueryString["Delete"] != null && id > 0) { try { TypeDao.Delete(id); LtlMessage.Text = Utils.GetMessageHtml("成功删除分类法", true); } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml($"删除分类法失败,{ex.Message}", false); } } else if ((Request.QueryString["Up"] != null || Request.QueryString["Down"] != null) && id > 0) { var isDown = Request.QueryString["Down"] != null; if (isDown) { TypeDao.UpdateTaxisToUp(id, channelId); LtlMessage.Text = Utils.GetMessageHtml($"排序成功", true); } else { TypeDao.UpdateTaxisToDown(id, channelId); LtlMessage.Text = Utils.GetMessageHtml($"排序成功", true); } } DgContents.DataSource = TypeDao.GetDataSource(channelId); DgContents.ItemDataBound += DgContents_ItemDataBound; DgContents.DataBind(); BtnAdd.Attributes.Add("onclick", ModalConfigTypeAdd.GetOpenWindowStringToAdd(SiteId, channelId)); } }
//查看已投票的问题 public ActionResult MyVote() { MyVoteModel model = new MyVoteModel(); UserDao userdao = new UserDao(); User user = userdao.getById(int.Parse(Request.Cookies["Menber"].Values["ID"])); VoteDao votedao = new VoteDao(); List <Vote> votes = votedao.getByUser(user); QuestionDao questiondao = new Dao.QuestionDao(); model.questions = new List <Question>(); foreach (Vote v in votes) { Question q = v.queID; model.questions.Add(q); } TypeDao typedao = new TypeDao(); model.types = typedao.getTypeList(); return(View(model)); }
//lấy ra danh sách thể loại cho bài đăng public void GetTypeForPost(long?selectedid = null) { var dao = new TypeDao(); ViewBag.IDTheLoai = new SelectList(dao.ListTypeForCreatePost(), "IDTheLoai", "TenTheLoai", selectedid); }
public static string GetTypeName(int typeId) { return(typeId > 0 ? TypeDao.GetTypeName(typeId) : string.Empty); }
public void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { PhConfig.Visible = false; var type = DdlType.SelectedValue; var channelId = Utils.ToInt(DdlChannelId.SelectedValue); var apiKey = TbApiKey.Text; PhCode.Visible = true; if (type == "Add") { var departmentBuilder = new StringBuilder(); var departmentInfoList = DepartmentDao.GetDepartmentInfoList(); foreach (var departmentInfo in departmentInfoList) { departmentBuilder.Append( $@"<option value=""{departmentInfo.Id}"">{departmentInfo.DepartmentName}</option>").AppendLine(); } var typeBuilder = new StringBuilder(); var typeInfoList = TypeDao.GetTypeInfoList(channelId); foreach (var typeInfo in typeInfoList) { typeBuilder.Append( $@"<option value=""{typeInfo.Id}"">{typeInfo.TypeName}</option>").AppendLine(); } TbCode.Text = $@"<script src=""https://unpkg.com/vue/dist/vue.min.js""></script> <script src=""https://unpkg.com/axios/dist/axios.min.js""></script> <style> #govInteractAdd table {{ width: 100%; height: 100%; border-left: 1px solid silver; border-top: 1px solid silver }} #govInteractAdd td {{ height: 30px; padding: 5px; margin: 5px; text-align: right; padding-right: 8px; width: 90px; background: #F8F8F8; border-bottom: 1px solid silver; border-right: 1px solid silver }} #govInteractAdd td.field {{ text-align: left; }} #govInteractAdd input {{ padding-left: 5px; margin-left: 8px; width: 200px; height: 24px; line-height: 20px; border: 1px solid #9AABBB }} #govInteractAdd select {{ margin-left: 8px; height: 24px; line-height: 20px; border: 1px solid #9AABBB }} #govInteractAdd textarea {{ padding-left: 5px; margin-left: 8px; border: 1px solid #9AABBB; line-height: 20px; width: 90%; height: 180px; }} #govInteractAdd .error {{ border: 1px solid #F00 !important; }} #govInteractAdd .buttons {{ margin: 10px auto; text-align: center; }} #govInteractAdd .button {{ cursor: pointer; background-color: #4CAF50; border: none; color: white; padding: 8px 22px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; }} #govInteractAdd a.button {{ text-decoration: none; }} #govInteractAdd .success {{ margin: 0 auto; font-size: 16px; color: #090 !important; padding: 10px; text-align: left; line-height: 160%; font-weight: 700 }} #govInteractAdd .failure {{ margin: 0 auto; font-size: 16px; color: #C00 !important; padding: 10px; text-align: left; line-height: 160%; font-weight: 700 }} </style> <div id=""govInteractAdd""> <template v-if=""elType === 'success'""> <div class=""success""> 您的信息已经提交成功,相关部门将会尽快处理 <br /> 您可以通过查询号查询到该信息的办理情况 <br /> 请您记住查询号:{{{{ content.queryCode }}}} </div> </template> <template v-if=""elType === 'failure'""> <div class=""failure""> 提交失败,请确认提交内容是否正确。 </div> </template> <template v-if=""elType === 'form' || elType === 'failure'""> <table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0""> <tbody> <tr> <td class=""attribute"">姓名</td> <td class=""field""> <input v-model=""content.realName"" v-bind:class=""{{ error: isSubmit && !content.realName }}"" type=""text"" /> </td> <td class=""attribute"">工作单位</td> <td class=""field""> <input v-model=""content.organization"" v-bind:class=""{{ error: isSubmit && !content.organization }}"" type=""text"" /> </td> </tr> <tr> <td class=""attribute"">证件名称</td> <td class=""field""> <select id=""CardType"" name=""CardType""> <option value=""身份证"" selected>身份证</option> <option value=""学生证"">学生证</option> <option value=""军官证"">军官证</option> <option value=""工作证"">工作证</option> </select> </td> <td class=""attribute"">证件号码</td> <td class=""field""> <input v-model=""content.cardNo"" v-bind:class=""{{ error: isSubmit && !content.cardNo }}"" type=""text"" /> </td> </tr> <tr> <td class=""attribute"">联系电话</td> <td class=""field""> <input v-model=""content.phone"" v-bind:class=""{{ error: isSubmit && !content.phone }}"" type=""text"" /> </td> <td class=""attribute"">邮政编码</td> <td class=""field""> <input v-model=""content.postCode"" v-bind:class=""{{ error: isSubmit && !content.postCode }}"" type=""text"" /> </td> </tr> <tr> <td class=""attribute"">联系地址</td> <td colspan=""3"" class=""field""> <input v-model=""content.address"" v-bind:class=""{{ error: isSubmit && !content.address }}"" type=""text"" value="""" style=""width:380px;"" /> </td> </tr> <tr> <td class=""attribute"">电子邮件</td> <td class=""field""> <input v-model=""content.email"" v-bind:class=""{{ error: isSubmit && !content.email }}"" type=""text"" /> </td> <td class=""attribute"">传真</td> <td class=""field""> <input v-model=""content.fax"" type=""text"" /> </td> </tr> <tr> <td class=""attribute"">类型</td> <td class=""field""> <select v-model=""content.typeId"" v-bind:class=""{{ error: isSubmit && content.typeId === 0 }}""> <option value=""0""><<请选择>></option> {typeBuilder} </select> </td> <td class=""attribute"">是否公开</td> <td class=""field""> <select v-model=""content.isPublic""> <option value=""true"">公开</option> <option value=""false"">不公开</option> </select> </td> </tr> <tr> <td class=""attribute"">标题</td> <td colspan=""3"" class=""field""> <input v-model=""content.title"" v-bind:class=""{{ error: isSubmit && !content.title }}"" type=""text"" style=""width:380px;"" /> </td> </tr> <tr> <td class=""attribute"">内容</td> <td colspan=""3"" class=""field""> <textarea v-model=""content.content"" v-bind:class=""{{ error: isSubmit && !content.content }}""></textarea> </td> </tr> <tr> <td class=""attribute"">提交对象</td> <td colspan=""3"" class=""field""> <select v-model=""content.departmentId"" v-bind:class=""{{ error: isSubmit && content.departmentId === 0 }}""> <option value=""0""><<请选择>></option> {departmentBuilder} </select> </td> </tr> </tbody> </table> <div class=""buttons""> <a href=""javascript:;"" class=""button"" v-on:click=""submit()"">提 交</a> </div> </template> </div> <script type=""text/javascript""> var govInteractAdd = new Vue({{ el: '#govInteractAdd', data: {{ elType: 'form', isSubmit: false, content: {{ cardType: '身份证', isPublic: true, typeId: 0, departmentId: 0 }} }}, methods: {{ s4: function () {{ return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); }}, queryCode: function () {{ return this.s4().toUpperCase() + this.s4().toUpperCase() + this.s4().toUpperCase() + this.s4().toUpperCase(); }}, submit: function () {{ var $this = this; this.isSubmit = true; var content = this.content; if (!content.realName || !content.organization || !content.cardNo || !content.phone || !content.postCode || !content.address || !content.email || content.typeId === 0 || !content.title || !content.content || content.departmentId === 0) {{ return; }} content.queryCode = this.queryCode(); axios.post('/api/v1/contents/{SiteId}/{channelId}', content, {{ withCredentials: true, headers: {{ 'X-SS-API-KEY': '{apiKey}' }}, }}) .then(function (response) {{ if (response.data) {{ $this.elType = 'success'; }} }}) .catch(function (error) {{ $this.elType = 'failure'; }}); }} }} }}) </script> "; } else { TbCode.Text = $@"<script src=""https://unpkg.com/vue/dist/vue.min.js""></script> <script src=""https://unpkg.com/axios/dist/axios.min.js""></script> <style> #govInteractQuery table {{ width: 100%; height: 100%; border-left: 1px solid silver; border-top: 1px solid silver }} #govInteractQuery td {{ height: 30px; padding: 5px; margin: 5px; text-align: right; padding-right: 8px; width: 90px; background: #F8F8F8; border-bottom: 1px solid silver; border-right: 1px solid silver }} #govInteractQuery td.field {{ text-align: left; }} #govInteractQuery input {{ padding-left: 5px; margin-left: 8px; width: 200px; height: 24px; line-height: 20px; border: 1px solid #9AABBB }} #govInteractQuery select {{ margin-left: 8px; height: 24px; line-height: 20px; border: 1px solid #9AABBB }} #govInteractQuery textarea {{ padding-left: 5px; margin-left: 8px; border: 1px solid #9AABBB; line-height: 20px; width: 90%; height: 180px; }} #govInteractQuery .error {{ border: 1px solid #F00 !important; }} #govInteractQuery .buttons {{ margin: 10px auto; text-align: center; }} #govInteractQuery .button {{ cursor: pointer; background-color: #4CAF50; border: none; color: white; padding: 8px 22px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; }} #govInteractQuery a.button {{ text-decoration: none; }} #govInteractQuery .success {{ margin: 0 auto; font-size: 16px; color: #090 !important; padding: 10px; text-align: left; line-height: 160%; font-weight: 700 }} #govInteractQuery .failure {{ margin: 0 auto; font-size: 16px; color: #C00 !important; padding: 10px; text-align: left; line-height: 160%; font-weight: 700 }} </style> <div id=""govInteractQuery""> <template v-if=""elType === 'success'""> <div class=""success""> <table border=""0"" cellspacing=""0"" cellpadding=""0""> <tr> <td class=""label"">姓名</td> <td class=""field"">{{{{ content.realName }}}}</td> <td class=""label"">工作单位</td> <td class=""field"">{{{{ content.organization }}}}</td> </tr> <tr> <td class=""label"">证件名称</td> <td class=""field"">{{{{ content.cardType }}}}</td> <td class=""label"">证件号码</td> <td class=""field"">{{{{ content.cardNo }}}}</td> </tr> <tr> <td class=""label"">联系电话</td> <td class=""field"">{{{{ content.phone }}}}</td> <td class=""label"">邮政编码</td> <td class=""field"">{{{{ content.postCode }}}}</td> </tr> <tr> <td class=""label"">联系地址</td> <td colspan=""3"" class=""field"">{{{{ content.address }}}}</td> </tr> <tr> <td class=""label"">电子邮件</td> <td class=""field"">{{{{ content.email }}}}</td> <td class=""label"">传真</td> <td class=""field"">{{{{ content.fax }}}}</td> </tr> <tr> <td class=""label"">标题</td> <td colspan=""3"" class=""field"">{{{{ content.title }}}}</td> </tr> <tr> <td class=""label"">内容</td> <td colspan=""3"" class=""field"">{{{{ content.content }}}}</td> </tr> <tr> <td class=""label"">处理状态</td> <td class=""field"" colspan=""3"">{{{{ getState() }}}}</td> </tr> <tr v-if=""isReply()""> <td class=""label"">办理部门</td> <td class=""field"" colspan=""3"">{{{{ content.replyDepartmentName }}}}</td> </tr> <tr v-if=""isReply()""> <td class=""label"">办理人员</td> <td class=""field"" colspan=""3"">{{{{ content.replyUserName }}}}</td> </tr> <tr v-if=""isReply()""> <td class=""label"">办理日期</td> <td class=""field"" colspan=""3"">{{{{ content.replyAddDate }}}}</td> </tr> <tr v-if=""isReply()""> <td class=""label"">回复内容</td> <td height=""150"" class=""field"" colspan=""3"">{{{{ content.replyContent }}}}</td> </tr> </table> </div> </template> <template v-if=""elType === 'failure'""> <div class=""failure""> 提交失败,请确认姓名及查询号是否正确。 </div> </template> <template v-if=""elType === 'form' || elType === 'failure'""> <table border=""0"" cellpadding=""0"" cellspacing=""0""> <tbody> <tr> <td>姓名:</td> <td class=""field""> <input v-model=""content.realName"" v-bind:class=""{{ error: isSubmit && !content.realName }}"" type=""text""> </td> </tr> <tr> <td>查询号:</td> <td class=""field""> <input v-model=""content.queryCode"" v-bind:class=""{{ error: isSubmit && !content.queryCode }}"" type=""text""> </td> </tr> </tbody> </table> <div class=""buttons""> <a href=""javascript:;"" class=""button"" v-on:click=""submit()"">查 询</a> </div> </template> </div> <script type=""text/javascript""> var govInteractQuery = new Vue({{ el: '#govInteractQuery', data: {{ elType: 'form', isSubmit: false, content: {{}} }}, methods: {{ getState: function () {{ if (this.content.state == 'Denied') {{ return ""拒绝受理""; }} if (this.content.state == 'Checked') {{ return ""办理完毕""; }} return ""办理中""; }}, isReply: function() {{ return this.content.state == 'Checked'; }}, submit: function () {{ var $this = this; this.isSubmit = true; var content = this.content; if (!content.realName || !content.queryCode) {{ return; }} axios.get('/api/v1/contents/{SiteId}/{channelId}', {{ params: {{ realName: content.realName, queryCode: content.queryCode }}, headers: {{ 'X-SS-API-KEY': '{apiKey}' }} }}) .then(function (response) {{ console.log(response.data.value); if (response.data.value && response.data.value.length > 0) {{ $this.content = response.data.value[0]; $this.elType = 'success'; }} else {{ $this.elType = 'failure'; }} }}) .catch(function (error) {{ $this.elType = 'failure'; }}); }} }} }}) </script>"; } } }