Song.ServiceImpls/DepartCom.cs
(开头部分) 15KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using WeiSha.Common;
using Song.Entities;
using WeiSha.Data;
using Song.ServiceInterfaces;
using System.Data.Common;
using System.Xml;
namespace Song.ServiceImpls
{
public class DepartCom :IDepart
{
/// <summary>
/// 添加
/// </summary>
/// <param name="entity">业务实体</param>
public int Add(Depart entity)
{
Song.Entities.Organization org = Business.Do<IOrganization>().OrganCurrent();
if (org != null)
{
entity.Org_ID = org.Org_ID;
entity.Org_Name = org.Org_Name;
}
//如果没有排序号,则自动计算
if (entity.Dep_Tax < 1)
{
object obj = Gateway.Default.Max<Depart>(Depart._.Dep_Tax, Depart._.Org_ID == org.Org_ID && Depart._.Dep_PatId == entity.Dep_PatId);
entity.Dep_Tax = obj is int ? (int)obj + 1 : 0;
}
//
Gateway.Default.Save<Depart>(entity);
entity = Gateway.Default.From<Depart>().OrderBy(Depart._.Dep_Id.Desc).ToFirst<Depart>();
return entity.Dep_Id;
}
/// <summary>
/// 修改
/// </summary>
/// <param name="entity">业务实体</param>
public void Save(Depart entity)
{
using (DbTrans tran = Gateway.Default.BeginTrans())
{
try
{
tran.Save<Depart>(entity);
tran.Update<EmpAccount>(new Field[] { EmpAccount._.Dep_CnName }, new object[] { entity.Dep_CnName }, EmpAccount._.Dep_Id == entity.Dep_Id);
tran.Update<Subject>(new Field[] { Subject._.Dep_CnName }, new object[] { entity.Dep_CnName }, Subject._.Dep_Id == entity.Dep_Id);
tran.Update<Course>(new Field[] { Course._.Dep_CnName }, new object[] { entity.Dep_CnName }, Course._.Dep_Id == entity.Dep_Id);
//tran.Update<Teacher>(new Field[] { Teacher._.Dep_CnName }, new object[] { entity.Dep_CnName }, Teacher._.Dep_Id == entity.Dep_Id);
tran.Update<StudentSort>(new Field[] { StudentSort._.Dep_CnName }, new object[] { entity.Dep_CnName }, StudentSort._.Dep_Id == entity.Dep_Id);
后面还有 352 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
