public int InsertUserRecord(string userName, string hashedPassword, string firstName, string lastName, string email, string updatedBy) { SqlCommand com = DataAccessHelper.CreateCommand("spInsertUsersRecord"); DataAccessHelper.AddStringInputParam(com, "UserName", userName); DataAccessHelper.AddStringInputParam(com, "UserPassword", hashedPassword); DataAccessHelper.AddStringInputParam(com, "UserFirstName", firstName); DataAccessHelper.AddStringInputParam(com, "UserLastName", lastName); DataAccessHelper.AddStringInputParam(com, "UserEmail", email); DataAccessHelper.AddDateTimeInputParam(com, "EnteredTime", DateTime.Now); DataAccessHelper.AddDateTimeInputParam(com, "UpdatedTime", DateTime.Now); DataAccessHelper.AddDateTimeInputParam(com, "DeactivatedTime", null); DataAccessHelper.AddStringInputParam(com, "EnteredBy", updatedBy); DataAccessHelper.AddStringInputParam(com, "UpdatedBy", updatedBy); DataAccessHelper.AddIntOutputParam(com, "NewPrimaryKey"); Hashtable outParams = DataAccessHelper.ExecuteScalar(com); if (outParams["NewPrimaryKey"] != System.DBNull.Value) { return((int)outParams["NewPrimaryKey"]); } else { return(-1); } }
public int InsertEFormsRecord(int userId, int patientId, string eformName, string eformXml, string currentStatus, object eformApptTime, string eformApptPhysician, string userName) { SqlCommand com = DataAccessHelper.CreateCommand("spInsertEFormsRecord"); DataAccessHelper.AddIntInputParam(com, "UserId", userId); DataAccessHelper.AddIntInputParam(com, "PatientId", patientId); DataAccessHelper.AddStringInputParam(com, "EformName", eformName); DataAccessHelper.AddTextInputParam(com, "EformXml", eformXml); DataAccessHelper.AddStringInputParam(com, "CurrentStatus", currentStatus); DataAccessHelper.AddDateTimeInputParam(com, "EformApptTime", DataAccessHelper.ToDBDate(eformApptTime)); DataAccessHelper.AddStringInputParam(com, "EformApptPhysician", eformApptPhysician); DataAccessHelper.AddStringInputParam(com, "UpdatedBy", userName); DataAccessHelper.AddDateTimeInputParam(com, "UpdatedTime", DateTime.Now); DataAccessHelper.AddStringInputParam(com, "EnteredBy", userName); DataAccessHelper.AddDateTimeInputParam(com, "EnteredTime", DateTime.Now); DataAccessHelper.AddIntOutputParam(com, "NewPrimaryKey"); Hashtable outParams = DataAccessHelper.ExecuteScalar(com); if (outParams["NewPrimaryKey"] != System.DBNull.Value) { return((int)outParams["NewPrimaryKey"]); } else { return(-1); } }
public bool UpdateUserPassword(int userId, string userNewPassword, string updatedBy) { SqlCommand com = DataAccessHelper.CreateCommand("spUpdateUserPassword"); DataAccessHelper.AddIntInputParam(com, "UserId", userId); DataAccessHelper.AddStringInputParam(com, "UserPassword", userNewPassword); DataAccessHelper.AddDateTimeInputParam(com, "UpdatedTime", DateTime.Now); DataAccessHelper.AddStringInputParam(com, "UpdatedBy", updatedBy); DataAccessHelper.AddIntOutputParam(com, "Valid"); DataAccessHelper.ExecuteScalar(com); return(true); }
public int RecordUserLogin(string userName) { SqlCommand com = DataAccessHelper.CreateCommand("spInsertUserLoginsRecord"); DataAccessHelper.AddStringInputParam(com, "userName", userName); DataAccessHelper.AddDateTimeInputParam(com, "UserLoginTime", DateTime.Now); DataAccessHelper.AddIntOutputParam(com, "NewPrimaryKey"); Hashtable ht = DataAccessHelper.ExecuteScalar(com); return((int)ht["NewPrimaryKey"]); }
public int GetMaxShipmentNumber() { SqlCommand com = DataAccessHelper.CreateCommand("spGetSeedShipmentNumMax"); DataAccessHelper.AddIntOutputParam(com, "MaxNum"); Hashtable ht = DataAccessHelper.ExecuteScalar(com); if (ht["MaxNum"] != null && !ht["MaxNum"].ToString().Equals("")) { return((int)ht["MaxNum"]); } else { return(0); } }
public int GetUserId(string userName) { SqlCommand com = DataAccessHelper.CreateCommand("spGetUserId"); DataAccessHelper.AddStringInputParam(com, "UserName", userName); DataAccessHelper.AddIntOutputParam(com, "UserId"); Hashtable ht = DataAccessHelper.ExecuteScalar(com); if (ht["UserId"] != null) { return((int)ht["UserId"]); } else { return(0); } }
public int GetPrimKey(string diseaseName) { SqlCommand com = DataAccessHelper.CreateCommand("spGetDatasetDimensionValue"); DataAccessHelper.AddStringInputParam(com, "Dimension", "Diseases"); DataAccessHelper.AddStringInputParam(com, "InputValue", diseaseName); DataAccessHelper.AddIntOutputParam(com, "OutputValue"); Hashtable outParams = DataAccessHelper.ExecuteScalar(com); if (outParams["OutputValue"] != System.DBNull.Value) { return((int)outParams["OutputValue"]); } else { return(-1); } }
public int GetRecordCount(string tableName, string fieldName, int parentKey) { SqlCommand com = DataAccessHelper.CreateCommand("spGetRecordCountById"); DataAccessHelper.AddStringInputParam(com, "TableName", tableName); DataAccessHelper.AddStringInputParam(com, "FieldName", fieldName); DataAccessHelper.AddIntInputParam(com, "Id", parentKey); DataAccessHelper.AddIntOutputParam(com, "Rowcount"); Hashtable outParams = DataAccessHelper.ExecuteScalar(com); if (outParams["Rowcount"] != System.DBNull.Value) { return((int)outParams["Rowcount"]); } else { return(-1); } }