public static void InsertClass(Guid OrganizationId, int DepartmentId, ClassData cd) { lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext dc = new lib.bwa.bigWebDesk.LinqBll.Context.MutiBaseDataContext(OrganizationId, DepartmentId); Context.Tbl_class c = new Context.Tbl_class(); FillClass(cd, c); dc.Tbl_class.InsertOnSubmit(c); dc.SubmitChanges(); }
static void FillClass(ClassData s, Context.Tbl_class d) { if (s.IsAdded("parent_class_id")) { d.ParentId = GetNullId(s.parent_class_id); } if (s.IsAdded("name")) { d.Name = s.name; } if (s.IsAdded("description")) { d.TxtDesc = s.description; } if (s.IsAdded("active") && s.active != null) { d.BtInactive = !(bool)s.active; } if (s.IsAdded("priority_id")) { d.IntPriorityId = GetNullId(s.priority_id); } if (s.IsAdded("level")) { d.TintLevelOverride = (s.level == null ? null : (byte?)(byte)((int)s.level)); } if (s.IsAdded("last_resort_tech_userid")) { d.LastResortTechId = GetId(s.last_resort_tech_userid); } if (s.IsAdded("class_type_id")) { d.TintClassType = GetByte(s.class_type_id); } if (s.IsAdded("routing_type_id")) { d.ConfigDistributedRouting = GetByte(s.routing_type_id); } }