public static UserBLL GetDetails(int UserID) { DataTable dt = UserDAL.GetDetails(UserID).Tables[0]; UserBLL u; if (dt.Rows.Count > 0) { u = (UserBLL)(dt.Rows[0]); } else { u = new UserBLL(); } return u; }
public int Save() { UserBLL u = UserBLL.GetDetails(UserName); if (u == null) { u = new UserBLL(Title, FirstName, LastName, UserName, Password, EMail, ChangePassword, Language, AllowUserCreation, AllowUserEnrolment, AllowScheduledReports, RegionID, EntityID); } else { u.Title = Title; u.FirstName = FirstName; u.LastName = LastName; u.Password = Password; u.EMail = EMail; u.PasswordReset = ChangePassword ? "y" : "n"; u.LanguageCode = Language; u.Dashboard = AllowUserCreation || AllowUserEnrolment || AllowScheduledReports; u.UserManagementAccess = AllowUserCreation; u.UserEnrolmentAccess = AllowUserEnrolment; u.ScheduledReportsAccess = AllowScheduledReports; u.RegionID = RegionID; u.EntityID = EntityID; } int ID = u.SaveOrUpdate(); return ID; }