public static bool LoginCredentialAccepted(String Username, String Password) { ITransactionHandler VTransactionHandler = new ITransactionHandler(); String CommandText = "SELECT Id, [Password], FormalName FROM tblSystemUsers " + "WHERE Username = @Username " + "COLLATE Latin1_General_CS_AS"; JkFormParameter param = new JkFormParameter(); List <JkFormParameter> paramList = new List <JkFormParameter>(); DataTable table = new DataTable(); param.Name = "Username"; param.Value = Username; paramList.Add(param); table = VTransactionHandler.LoadData(CommandText, paramList); if (table.Rows.Count > 0) { //TODO: Company information should also be based on login ISecurityHandler.CompanyId = 1; ISecurityHandler.CompanyName = "Jk Computer Systems Inc."; ISecurityHandler.SecurityUserId = int.Parse(table.Rows[0][0].ToString()); ISecurityHandler.SecurityUserName = table.Rows[0][2].ToString(); return(ValidatePassword(Password, table.Rows[0][1].ToString())); } return(false); }
public static Object ConvertMaskValue(Object PDefaultValue) { Object value; switch (PDefaultValue.ToString()) { case "@CompanyId": value = ISecurityHandler.CompanyId; break; case "@SecurityUserId": value = ISecurityHandler.SecurityUserId; break; case "@Date": ITransactionHandler VTransactionHandler = new ITransactionHandler(); DataTable VDataTable = new DataTable(); try { VTransactionHandler.LoadData("SELECT GETDATE() AS CurrentDate", ref VDataTable, null); value = VDataTable.Rows[0][0].ToString(); } finally { VDataTable.Dispose(); } break; case "@CurrentMonthFrom": value = IDateHandler.CurrentMonth(true).ToString("MM'/'dd'/'yyyy"); break; case "@CurrentMonthTo": value = IDateHandler.CurrentMonth(false).ToString("MM'/'dd'/'yyyy"); break; default: value = PDefaultValue; break; } return(value); }