/// <summary> /// ����ϵͳ���롣 /// </summary> /// <param name="dto">������ϵͳ�������Ϣ��</param> /// <returns>��ϵͳ�����Id����-2��Tag�ظ�����</returns> public static string InsertSysCode(SysCodeDTO dto) { SysCode existingSc = GetSysCodeByTag(dto.Tag); if (existingSc != null) { return "-2"; } Db.SessionFactory.EvictQueries("SysCode"); SysCode sc = new SysCode(); sc.Id = IdGen.GetNextId(typeof(SysCode)); sc.Tag = dto.Tag; sc.Name = dto.Name; sc.Remark = dto.Remark; sc.OrderId = dto.OrderId; SysCodeType sct = Db.Session.Load(typeof(SysCodeType), dto.SysCodeTypeId) as SysCodeType; sct.AddSysCode(sc); Db.TransInsert(sc); return sc.Id; }
/// <summary> /// ����ϵͳ���롣 /// </summary> /// <param name="dto">������ϵͳ�������Ϣ��</param> /// <returns>�ɹ���ʾ����1���ɹ���-2��Tag�ظ�����</returns> public static string UpdateSysCode(SysCodeDTO dto) { SysCode existingSc = GetSysCodeByTag(dto.Tag); if (existingSc != null && existingSc.Id != dto.Id) { return "-2"; } Db.SessionFactory.EvictQueries("SysCode"); SysCode sc = Db.Session.Load(typeof(SysCode), dto.Id) as SysCode; sc.Tag = dto.Tag; sc.Name = dto.Name; sc.Remark = dto.Remark; sc.OrderId = dto.OrderId; Db.TransUpdate(sc); return "1"; }