sync.expert.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using BizCom;
  2. using Castle.ActiveRecord;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Reflection;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Web;
  11. using System.Web.SessionState;
  12. namespace SiteCore.Handler
  13. {
  14. public partial class sync
  15. {
  16. public void get_expert()
  17. {
  18. DataStruct dStruct = GetStruct();
  19. List<string> lw = new List<string>();
  20. string key = GetPostString("key");
  21. if (key.Length > 0) lw.Add(string.Format("name like '%{0}%'", key));
  22. dStruct.Order = "id desc";
  23. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  24. DataTable dt = WebCache.GetData("s_expert", dStruct);
  25. writeGridJson(dStruct.TotalCount, Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
  26. }
  27. public void del_expert()
  28. {
  29. if(UrlParmsCheck("eid"))
  30. {
  31. int eid = GetInt("eid");
  32. SExpert.Del(eid);
  33. returnSuccessMsg("删除成功");
  34. }
  35. }
  36. public void save_expert()
  37. {
  38. if (UrlPostParmsCheck("name,type,duites,intro"))
  39. {
  40. int eid = GetPostInt("eid");
  41. string name = GetPostString("name");
  42. int type = GetPostInt("type");
  43. string imgs = GetPostString("imgs");
  44. string duites = GetPostString("duites");
  45. string intro = GetPostString("intro");
  46. SExpert entity = null;
  47. if (eid > 0) entity = SExpert.Get(eid);
  48. else entity = new SExpert();
  49. if (imgs.Length > 0)
  50. {
  51. entity.headImg = imgs.Split(',')[0];
  52. entity.Imgs = imgs;
  53. }
  54. entity.Name = name;
  55. entity.ExType = type;
  56. entity.Duties = duites;
  57. entity.Intro = intro;
  58. if (eid > 0) entity.Update();
  59. else {
  60. entity.AddTime = DateTime.Now;
  61. entity.Create();
  62. }
  63. returnSuccessMsg("保存成功!");
  64. }
  65. }
  66. }
  67. }