|
- using HKLib.DB;
- using HKLib.DB.Model.Entity;
- using HKLib.Interfaces;
- using System;
- using System.Collections.Generic;
- using System.Text;
-
- namespace HKLib.Logic
- {
- public class ServiceHandler
- {
- #region 机构类
- public static bool AddOrg(string Name)
- {
- var check = DbContext.Context.Queryable<OrgTable>().First(t => t.Name == Name);
- if (check != null) return false;
- var SiD = HKLibHelper.SetOrg(Name);
- return DbContext.Context.Insertable(new OrgTable
- {
- Name = Name,
- SId = SiD
- }).CallEntityMethod(t => t.Create()).ExecuteCommand() > 0;
- }
- public static List<OrgTable> GetOrgList()
- {
- return DbContext.Context.Queryable<OrgTable>().ToList();
- }
- public static bool AlterOrg(string Name, string Id)
- {
- var s = HKLibHelper.AlterOrg(Name, Id);
- if (s)
- return DbContext.Context.Updateable<OrgTable>().SetColumns(t => t.Name == Name).Where(t => t.SId == Id).ExecuteCommandHasChange();
- else return false;
- }
- #endregion
- }
- }
|