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 ColumnsCom : IColumns { public int Add(Song.Entities.Columns entity) { entity.Col_CrtTime = DateTime.Now; //如果没有排序号,则自动计算 if (entity.Col_Tax < 1) { object obj = Gateway.Default.Max( Columns._.Col_Tax,Columns._.Col_PID == entity.Col_PID); entity.Col_Tax = obj is int ? (int)obj + 1 : 0; } Song.Entities.Organization org = Business.Do().OrganCurrent(); if (org != null) { entity.Org_ID = org.Org_ID; entity.Org_Name = org.Org_Name; } return Gateway.Default.Save(entity); } public void Save(Song.Entities.Columns entity) { using (DbTrans trans = Gateway.Default.BeginTrans()) { try { trans.Save(entity); //新闻,产品,图片,视频,下载 trans.Update
(new Field[] { Article._.Col_Name }, new object[] { entity.Col_Name }, Article._.Col_Id == entity.Col_ID); trans.Update(new Field[] { Product._.Col_Name }, new object[] { entity.Col_Name }, Product._.Col_Id == entity.Col_ID); trans.Update(new Field[] { Picture._.Col_Name }, new object[] { entity.Col_Name }, Picture._.Col_Id == entity.Col_ID); trans.Update