namespace EntitlementDAL.Query.User { /// /// MUSER INSERT — copied verbatim from FrameworkDAL.Query.User.UserQB.SAVE_USER/SAVE_USER_PG /// (SQL Server + Postgres dialects only; Entitlement never runs against Oracle/MySQL). Kept /// as a private duplicate rather than a FrameworkDAL reference so PlatformHost/EntitlementSL /// never needs to load FrameworkBLL/FrameworkDAL — see IClientUserProvisioner's doc comment. /// public static class EntitlementUserQB { public const string SAVE_USER = @"INSERT INTO MUSER ( USERID, USERCODE, USERNAME, USERLOGINNAME, PASSWORD, DOB, USERTYPE, NATURE, SECURITYLEVEL, SECURITYQUESTIONID, SECURITYANSWER, REMARKS, ISEMPLOYEE, ISPARTNER, PARTNERID, PARTNERUSERID, VALIDFROM, VALIDTO, ROLEID, PRIMARYMAIL, PRIMARYMOBILE, PRIMARYPHONE, PASSWORDPOLICYID, WORKOUID, WORKPERIODID, WORKPARTYBRANCHID, WORKSTOREID, WORKDATE, LASTSUCCESSLOGINON, LASTFAILUREATTEMPTON, PREVIOUSPASSWORD1, PREVIOUSPASSWORD2, PREVIOUSPASSWORD3, PASSWORDCHANGEDON, PREVIOUSLOGIN, WORKREGIONID, MODEOFOPERATION, USERCRITERIACONFIGID, SORTORDER, STATUS, VERSION, SOURCETYPE, TENANTID, DEFAULTIMAGEID, CREATEDBYID, CREATEDON, MODIFIEDBYID, MODIFIEDON, DEFAULTCMSID, USERDATEFORMAT, USERCURRENCYFORMAT, USERTIMEFORMAT, USERQUANTITYFORMAT, THEMEOPTION, NOOFSESSIONS, LOGINONWORKDAYSONLY, LOGINFROMTIME, LOGINTOTIME, LOGINMACHINE, LOGINIP, DIGITALSIGNEDFILE, DIGITALFILEPASSWORD, DEFAULTMENUID, WORKFINANCEBOOKID, TIMEZONEID, DEFAULTDEVICEID, DELIMITER, ISOUTOFOFFICE, OUTOFOFFICEFROMDATE, OUTOFOFFICETODATE, OUTOFOFFICEREMARKS, ESIGNATURECMSID, MMAILID, PUNCHTYPE, MFAUSERSETTING, MFAUSERACCOUNTID, MFAUSERSECRETKEY, MFAQRCODE, SHOWQRCODE, NUMBEROFFAILUREATTEMPTS, THUMBNAIL, THEMEMODE, LANGUAGEID, CRITERIARUNTYPE, DIGITALKEYLOCATION ) VALUES ( @UserId, @UserCode, @UserName, @UserLoginName, @UserPassword, @UserDOB, @UserType, @UserNature, @UserSecurityLevel, @SecurityQuestionId, @UserSecurityAnswer, @UserRemarks, @UserIsEmployee, @UserIsPartner, @UserPartnerId, @PartnerUserId, @UserValidFrom, @UserValidTo, @RoleId, @UserPrimaryMail, @UserPrimaryMobile, @UserPrimaryPhone, @PasswordPolicyId, @UserWorkOuId, @UserWorkPeriodId, @UserWorkPartyBranchId, @UserWorkStoreId, @UserWorkDate, @UserLastSuccessLoginOn, @UserLastFailureAttemptOn, @UserPreviousPassword1, @UserPreviousPassword2, @UserPreviousPassword3, @UserPasswordChangedOn, @UserPreviousLogin, @UserWorkRegionId, @UserModeofOperation, @UserCriteriaConfigId, @UserSortOrder, @UserStatus, @UserVersion, @UserSourceType, @TenantId, @ImageId, @UserCreatedById, @UserCreatedOn, @UserModifiedById, @UserModifiedOn, @UserDefaultCMSId, @UserDateFormat, @UserCurrencyFormat, @UserTimeFormat, @UserQuantityFormat, @UserThemeOption, @UserNoOfSessions, @UserLoginonWorkDaysOnly, @UserLoginFromTime, @UserLoginToTime, @UserLoginMachine, @UserLoginIp, @UserDigitalSignedFile, @UserDigitalFilePassword, @DefaultMenuId, @WorkFinanceBookId, @TimeZoneId, @DefaultDeviceId, @UserDelimiter, @UserIsOutOfOffice, @UserOutOfOfficeFromDate, @UserOutOfOfficeToDate, @UserOutOfOfficeRemarks, @UserESignaturecmsId, @MMailId, @UserPunchType, @UserMFAUserSetting, @UserMFAUserAccountId, @UserMFAUserSecretKey, @UserMFAQRCode, @UserShowQRCode, @UserNumberOfFailureAttempts, @UserThumbNail, @UserThemeMode, @UserLanguageId, @UserCriteriaRunType, @UserDigitalKeyLocation ); "; public const string SAVE_USER_PG = @"INSERT INTO muser ( userid, usercode, username, userloginname, password, dob, usertype, nature, securitylevel, securityquestionid, securityanswer, remarks, isemployee, ispartner, partnerid, partneruserid, validfrom, validto, roleid, primarymail, primarymobile, primaryphone, passwordpolicyid, workouid, workperiodid, workpartybranchid, workstoreid, workdate, lastsuccessloginon, lastfailureattempton, previouspassword1, previouspassword2, previouspassword3, passwordchangedon, previouslogin, workregionid, modeofoperation, usercriteriaconfigid, sortorder, status, version, sourcetype, tenantid, defaultimageid, createdbyid, createdon, modifiedbyid, modifiedon, defaultcmsid, userdateformat, usercurrencyformat, usertimeformat, userquantityformat, themeoption, noofsessions, loginonworkdaysonly, loginfromtime, logintotime, loginmachine, loginip, digitalsignedfile, digitalfilepassword, defaultmenuid, workfinancebookid, timezoneid, defaultdeviceid, delimiter, isoutofoffice, outofofficefromdate, outofofficetodate, outofofficeremarks, esignaturecmsid, mmailid, punchtype, mfausersetting, mfauseraccountid, mfausersecretkey, mfaqrcode, showqrcode, numberoffailureattempts, thumbnail, thememode, languageid, criteriaruntype, digitalkeylocation ) VALUES ( @UserId, @UserCode, @UserName, @UserLoginName, @UserPassword, @UserDOB, @UserType, @UserNature, @UserSecurityLevel, @SecurityQuestionId, @UserSecurityAnswer, @UserRemarks, @UserIsEmployee, @UserIsPartner, @UserPartnerId, @PartnerUserId, @UserValidFrom, @UserValidTo, @RoleId, @UserPrimaryMail, @UserPrimaryMobile, @UserPrimaryPhone, @PasswordPolicyId, @UserWorkOuId, @UserWorkPeriodId, @UserWorkPartyBranchId, @UserWorkStoreId, @UserWorkDate, @UserLastSuccessLoginOn, @UserLastFailureAttemptOn, @UserPreviousPassword1, @UserPreviousPassword2, @UserPreviousPassword3, @UserPasswordChangedOn, @UserPreviousLogin, @UserWorkRegionId, @UserModeofOperation, @UserCriteriaConfigId, @UserSortOrder, @UserStatus, @UserVersion, @UserSourceType, @TenantId, @ImageId, @UserCreatedById, @UserCreatedOn, @UserModifiedById, @UserModifiedOn, @UserDefaultCMSId, @UserDateFormat, @UserCurrencyFormat, @UserTimeFormat, @UserQuantityFormat, @UserThemeOption, @UserNoOfSessions, @UserLoginonWorkDaysOnly, @UserLoginFromTime, @UserLoginToTime, @UserLoginMachine, @UserLoginIp, @UserDigitalSignedFile, @UserDigitalFilePassword, @DefaultMenuId, @WorkFinanceBookId, @TimeZoneId, @DefaultDeviceId, @UserDelimiter, @UserIsOutOfOffice, @UserOutOfOfficeFromDate, @UserOutOfOfficeToDate, @UserOutOfOfficeRemarks, @UserESignaturecmsId, @MMailId, @UserPunchType, @UserMFAUserSetting, @UserMFAUserAccountId, @UserMFAUserSecretKey, @UserMFAQRCode, @UserShowQRCode, @UserNumberOfFailureAttempts, @UserThumbNail, @UserThemeMode, @UserLanguageId, @UserCriteriaRunType, @UserDigitalKeyLocation ); "; /// Tracker §49 Decision 8/9 — reads back a central account's admin identity /// (Name/Email/Mobile) to seed a real per-prospect MUSER inside a pooled demo instance's /// own physical database. A plain, narrow read — mirrors this file's own SAVE_USER scope /// (SQL Server + Postgres only; Entitlement never runs against Oracle/MySQL). public const string GET_USER_BY_ID = @"SELECT USERID AS UserId, USERCODE AS UserCode, USERNAME AS UserName, PRIMARYMAIL AS UserPrimaryMail, PRIMARYMOBILE AS UserPrimaryMobile FROM MUSER WHERE USERID = @UserId"; /// Tracker §49 — resolves a demo/trial ClientId's own admin contact for the /// warning-email step. ClientProvisioningBLL.CreateClientAsync always creates exactly one /// admin MUSER per new ClientId at registration time (TENANTID = the new ClientId), so /// TOP 1 reliably resolves it without a separate UserId being threaded through every call /// in the expiry/warning pipeline. public const string GET_USER_BY_CLIENT_ID = @"SELECT TOP 1 USERID AS UserId, USERCODE AS UserCode, USERNAME AS UserName, PRIMARYMAIL AS UserPrimaryMail, PRIMARYMOBILE AS UserPrimaryMobile FROM MUSER WHERE TENANTID = @ClientId ORDER BY USERID"; } }