public static int?AddChild(Guid OrgId, int DepartmentId, int FolderId, string ChildName) { using (lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc = new lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext(OrgId, DepartmentId, lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext.TransactionMode.ImmediateOpenConnection)) { lib.bwa.bigWebDesk.LinqBll.Context.Folders folder; if (FolderId != 0) { var folders = from f in dc.Folders where f.DId == DepartmentId && f.Id == FolderId select f; folder = folders.FirstOrNull(); if (folder == null) { return(null); } } folder = new lib.bwa.bigWebDesk.LinqBll.Context.Folders(); folder.DId = DepartmentId; folder.ParentId = FolderId; folder.VchName = ChildName.Length > 50 ? ChildName.Substring(0, 50) : ChildName; dc.Folders.InsertOnSubmit(folder); dc.SubmitChanges(); return(folder.Id); } }
public static int? AddChild(Guid OrgId, int DepartmentId, int FolderId, string ChildName) { using (lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc = new lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext(OrgId, DepartmentId, lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext.TransactionMode.ImmediateOpenConnection)) { lib.bwa.bigWebDesk.LinqBll.Context.Folders folder; if (FolderId != 0) { var folders = from f in dc.Folders where f.DId == DepartmentId && f.Id == FolderId select f; folder = folders.FirstOrNull(); if (folder == null) return null; } folder = new lib.bwa.bigWebDesk.LinqBll.Context.Folders(); folder.DId = DepartmentId; folder.ParentId = FolderId; folder.VchName = ChildName.Length>50 ? ChildName.Substring(0,50) : ChildName; dc.Folders.InsertOnSubmit(folder); dc.SubmitChanges(); return folder.Id; } }