25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

  1. using HKLib.DB;
  2. using HKLib.DB.Model.Entity;
  3. using HKLib.Interfaces;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. namespace HKLib.Logic
  8. {
  9. public class ServiceHandler
  10. {
  11. #region 机构类
  12. public static bool AddOrg(string Name)
  13. {
  14. var check = DbContext.Context.Queryable<OrgTable>().First(t => t.Name == Name);
  15. if (check != null) return false;
  16. var SiD = HKLibHelper.SetOrg(Name);
  17. return DbContext.Context.Insertable(new OrgTable
  18. {
  19. Name = Name,
  20. SId = SiD
  21. }).CallEntityMethod(t => t.Create()).ExecuteCommand() > 0;
  22. }
  23. public static List<OrgTable> GetOrgList()
  24. {
  25. return DbContext.Context.Queryable<OrgTable>().ToList();
  26. }
  27. public static bool AlterOrg(string Name, string Id)
  28. {
  29. var s = HKLibHelper.AlterOrg(Name, Id);
  30. if (s)
  31. return DbContext.Context.Updateable<OrgTable>().SetColumns(t => t.Name == Name).Where(t => t.SId == Id).ExecuteCommandHasChange();
  32. else return false;
  33. }
  34. #endregion
  35. }
  36. }