partial void DeleteSys_UserRoles_usr(Sys_UserRoles_usr instance);
partial void UpdateSys_UserRoles_usr(Sys_UserRoles_usr instance);
public bool InsertRecord(Sys_RoleMaster_rlm_Info infoObject) { if (infoObject == null) { return false; } using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext()) { Sys_RoleMaster_rlm rlm = new Sys_RoleMaster_rlm(); try { rlm = Common.General.CopyObjectValue<Sys_RoleMaster_rlm_Info, Sys_RoleMaster_rlm>(infoObject); if (infoObject.userMasterList != null && infoObject.userMasterList.Count > 0) { for (int i = 0; i < infoObject.userMasterList.Count; i++) { Sys_UserMaster_usm_Info usmInfo = infoObject.userMasterList[i]; Sys_UserRoles_usr item = new Sys_UserRoles_usr(); item.usr_cUserLoginID = usmInfo.usm_cUserLoginID; item.usr_cRoleID = infoObject.rlm_cRoleID; //courseitem.cum_cNumber; rlm.Sys_UserRoles_usr.Add(item); //db.Sys_UserRoles_usrs.InsertOnSubmit(item); } } db.Sys_RoleMaster_rlm.InsertOnSubmit(rlm); db.SubmitChanges(); return true; } catch (Exception Ex) { throw Ex; } } }
partial void InsertSys_UserRoles_usr(Sys_UserRoles_usr instance);
public bool InsertRecord(Model.SysMaster.Sys_UserMaster_usm_Info infoObject) { using (MainDBDataContext db = new MainDBDataContext()) { Sys_UserMaster_usm usm = new Sys_UserMaster_usm(); List<Sys_UserRoles_usr> usrs = new List<Sys_UserRoles_usr>(); try { usm = Common.General.CopyObjectValue<Sys_UserMaster_usm_Info, Sys_UserMaster_usm>(infoObject); if (infoObject.roleMasterList != null && infoObject.roleMasterList.Count > 0) { for (int i = 0; i < infoObject.roleMasterList.Count; i++) { Sys_RoleMaster_rlm_Info usmInfo = infoObject.roleMasterList[i]; Sys_UserRoles_usr item = new Sys_UserRoles_usr(); item.usr_cUserLoginID = infoObject.usm_cUserLoginID; item.usr_cRoleID = usmInfo.rlm_cRoleID; usrs.Add(item); } } db.Sys_UserRoles_usr.InsertAllOnSubmit(usrs); db.Sys_UserMaster_usm.InsertOnSubmit(usm); db.SubmitChanges(); return true; } catch (Exception Ex) { throw Ex; } } }