app.inst.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using BizCom;
  2. using SQLData;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace SiteCore.Handler
  10. {
  11. public partial class app
  12. {
  13. public void get_inst()
  14. {
  15. DataStruct dStruct = GetPostStruct();
  16. List<string> lw = new List<string>();
  17. string key = GetPostString("key");
  18. if (key.Length > 0) lw.Add(string.Format("name like '%{0}%'", key));
  19. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  20. dStruct.Order = "sort asc";
  21. dStruct.Fileds = "id,CoverImg as img,name,stars,tags,address";
  22. DataTable dt = WebCache.GetData("s_inst", dStruct);
  23. conGridJson(dStruct.TotalCount, Utils.Serialization.JsonString.DataTable2LowerAjaxJson(dt));
  24. }
  25. public void get_instinfo()
  26. {
  27. if(UrlPostParmsCheck("id"))
  28. {
  29. int id = GetPostInt("id");
  30. string sql = "select * from s_inst where id=" + id;
  31. DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
  32. conGridJson(dt.Rows.Count, Utils.Serialization.JsonString.DataTable2LowerAjaxJson(dt));
  33. return;
  34. }
  35. conError("错误的参数");
  36. }
  37. public void ins_inst()
  38. {
  39. UserObj uo = GetUserEntity();
  40. if (uo == null) return;
  41. int uid = uo.userid;
  42. if (UrlPostParmsCheck("eid,con"))
  43. {
  44. int eid = GetPostInt("eid");
  45. string sex = GetPostString("sex");
  46. string birthday = GetPostString("birthday");
  47. string mobile = GetPostString("mobile");
  48. string con = GetPostString("con");
  49. con = con.Replace("\r\n", "<br>").Replace("\n", "<br>");
  50. con = con.Replace(" ", "&nbsp;");
  51. string images = GetPostString("images").TrimEnd(',');
  52. SExpertQuestion entity = new SExpertQuestion();
  53. entity.AddTime = DateTime.Now;
  54. entity.UserID = uid;
  55. entity.ExpertID = eid;
  56. entity.Sex = sex;
  57. entity.Mobile = mobile;
  58. entity.BirthDay = birthday;
  59. entity.Con = con;
  60. entity.Imgs = images;
  61. entity.Create();
  62. conSuccess("提交提问!");
  63. return;
  64. }
  65. conError("错误的参数");
  66. }
  67. }
  68. }