当前位置: 首页>>代码示例>>C#>>正文


C# Entities.GetId方法代码示例

本文整理汇总了C#中Entities.GetId方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.GetId方法的具体用法?C# Entities.GetId怎么用?C# Entities.GetId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entities的用法示例。


在下文中一共展示了Entities.GetId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TeacherAdd

 public bool TeacherAdd(Entities db, Guid campusId, Guid departmentId, int ordinal, string name, string phone, string passwordInitial, State state, string email, string idCard, bool? gender, DateTime? birthday, string nationality, string birthplace, string address, string account, bool? perstaff, bool sync, out Guid gid, string ex)
 {
     gid = db.GetId();
     try
     {
         string key, salt;
         var password = HomoryCryptor.Encrypt(passwordInitial, out key, out salt);
         var user = new User
         {
             Id = gid,
             Account = account,
             RealName = name,
             DisplayName = name,
             Stamp = Guid.NewGuid(),
             Type = UserType.教师,
             Password = password,
             PasswordEx = null,
             CryptoKey = key,
             CryptoSalt = salt,
             Icon = "~/CommonX/默认/用户.png",
             State = state,
             Ordinal = ordinal,
             Description = null
         };
         var userTeacher = new Homory.Model.Teacher
         {
             Id = user.Id,
             Phone = phone,
             Email = email,
             Gender = gender,
             Birthday = birthday,
             Birthplace = birthplace,
             Address = address,
             Nationality = nationality,
             IDCard = idCard,
             PerStaff = perstaff ?? true,
             Sync = sync
         };
         var relation = new DepartmentUser
         {
             DepartmentId = departmentId,
             UserId = user.Id,
             TopDepartmentId = campusId,
             Type = DepartmentUserType.部门主职教师,
             State = State.启用,
             Ordinal = 0,
             Time = DateTime.Now
         };
         db.User.Add(user);
         db.Teacher.Add(userTeacher);
         db.DepartmentUser.Add(relation);
         db.SaveChanges();
         try { UserHelper.InsertUserEx(name, "C984AED014AEC7623A54F0591DA07A85FD4B762D", sync, state, account, departmentId.ToString().ToUpper(), gid.ToString().ToUpper(), phone, idCard, ordinal, 0, "1000", ex); } catch { }
         return true;
     }
     catch
     {
         return false;
     }
 }
开发者ID:Homory-Temp,项目名称:LeYi,代码行数:60,代码来源:Import.aspx.cs

示例2: StudentAdd

 public bool StudentAdd(Entities db, Guid campusId, Guid classId, int ordinal, string name, string account, string passwordInitial, State state, string uniqueId, string idCard, bool? gender, DateTime? birthday, string nationality, string birthplace, string address, string charger, string chargerContact)
 {
     try
     {
         string key, salt;
         var password = HomoryCryptor.Encrypt(passwordInitial, out key, out salt);
         var user = new User
         {
             Id = db.GetId(),
             Account = account,
             RealName = name,
             DisplayName = name,
             Stamp = Guid.NewGuid(),
             Type = UserType.学生,
             Password = password,
             PasswordEx = null,
             CryptoKey = key,
             CryptoSalt = salt,
             Icon = "~/Common/默认/用户.png",
             State = state,
             Ordinal = ordinal,
             Description = null
         };
         var userStudent = new Homory.Model.Student
         {
             Id = user.Id,
             UniqueId = uniqueId,
             Gender = gender,
             Birthday = birthday,
             Birthplace = birthplace,
             Address = address,
             Nationality = nationality,
             IDCard = idCard,
             Charger = charger,
             ChargerContact = chargerContact
         };
         var relation = new DepartmentUser
         {
             DepartmentId = classId,
             UserId = user.Id,
             TopDepartmentId = campusId,
             Type = DepartmentUserType.班级学生,
             State = State.启用,
             Ordinal = 0,
             Time = DateTime.Now
         };
         db.User.Add(user);
         db.Student.Add(userStudent);
         db.DepartmentUser.Add(relation);
         return true;
     }
     catch
     {
         return false;
     }
 }
开发者ID:Homory-Temp,项目名称:LeYi,代码行数:56,代码来源:Import.aspx.cs


注:本文中的Entities.GetId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。